Find XML Tags then apply para style

Hi everyone,
I need your help for find xml tags and apply para graph style in InDesign CS2. We have 200 xml files apply only 7 type of paragraph styles so any one help and any JS/Apply script or any other find and replace method. I am really appreciate of my bottom of heart.
thank you so much.

Hi,
Try:
#include "../XML Rules/glue code.jsx";
var myDoc = app.documents.item(0);
var myRuleSet = new Array (new applyParaStyle());
with(myDoc){
        var elements = xmlElements;
        __processRuleSet(elements.item(0), myRuleSet);
          function applyParaStyle(){
                    this.name = "Xp";
                    this.xpath = "//restaurant_name";
                    this.apply = function(myElement, myRuleProcessor){
                              with(myElement){
                switch(insertionPoints[0].parentTextFrames[0].parentPage.appliedMaster.name){
                    case "X-Master":                   
                    app.select(texts);
                    app.selection[0].fillColor = myDoc.colors.item("xxxx");
                    break;
                    case "guide-Scotland":
                    app.select(texts);
                    app.selection[0].fillColor = myDoc.colors.item("scotland");
                    default:                   
                    break;
                              return true;

Similar Messages

  • Find.text Then apply Paragraph.Style

    Hi Everyone,
    Is that possible we find the text then apply the paragraph style every find text.
    We find [CN] then apply paragraph style "Chap_Num", Find next  [CT] apply PS "Chap_TTL" Find next [COX1] apply PS "Chap_Para".
    Any trick find and apply para style one time.
    Thank you! I appreciate your help and explanation Adv.

    @s_ashok – you'll find the right methods and properties in the CHM file for InDesign CS2 at:
    http://www.jongware.com/idjshelp.html
    Just a few hints:
    InDesign CS2 does not support GREP search/replace, so every line in your code that points to GREP does not work.
    Further: "app.findTextPreferences" and "app.changeTextPreferences" were "app.findPreferences" and "app.changePreferences" in InDesign CS2. And then there were no "findChangeTextOptions" or any counterpart for that in CS2…
    That should get you running…
    I have no InDesign CS2 installed to debug, so this is all I can say…
    Uwe

  • Way to find XML Tag name from RDF

    Hi
    Is there some way by which simply looking at fields in RDF, we can find out what XML Tag will be used by the data shown by it. Actually I am using a RDF's output for my XML report. Finding XML tag for a particular field is difficult job.
    Thanks for your help.
    Regards
    Varun

    Got It :-) Just check the data source of field and that is the XML tag. Thanks

  • Map XML tag to an object style

    Hi everyone!
    I am not sure this is the correct place to post it, but i didn't find any "tagging" department of the forums.
    I do import some XML into ID document.
    Text nodes of my XML are imported properly, and i can map any tag of XML to one of the paragraph or table styles.
    But, when i import any images (or another ID documents) with <... href="..." />, how can i map that tag to an object style?
    ///////////// It would be very helpful for example when i'm going to set the stroke of 1pt to all of inline images of text frame.
    Please any feedback would be helpful.
    Alex.

    I will try to give an example, just to give a kick start ........... you need little bit of tweaking to meet your actual requirement:
    suppose you have an xml element "tag" having an attribute "@href" with object style name defined as  it's value. 
    <tag href="object_style_name">
    "object_style_name" is a object style and should exist in your document. To map the tag with the corresponding object style value you can use XMLRules in JS:
    //NOTE: NOT TESTED, BUT SHOULD WORK
    #include "glue code.jsx"
    main();
    function main(){
    if (app.documents.length != 0){
    var myDoc = app.activeDocument;
    var myRuleSet = new Array (
    new findObjAttribute("//*[@href]")
    with(myDoc){
    var elements = xmlElements;
    __processRuleSet(elements.item(0), myRuleSet);
    else{
    alert("You have no document open!");
    exit();
    function findObjAttribute(XPATH){
    this.name = "findObjAttribute";
    this.xpath = XPATH;
    this.apply = function(myElement, myRuleProcessor)
    //Just to check whether the collect element is selected
    var elmName=myElement.markupTag.name;
    var styleName=myElement.xmlAttributes.itemByName("href").value;
    with(myElement){
    try {
    applyObjectStyle(myDoc.objectStyles.item(styleName), true);
         } catch(e){};
    return true;
    HTH,
    Pankaj Chaturvedi

  • Indesign Javascript, find  xml tag from cursor position

    Hi All,
    I have a single textframe with multiple xml tags within formated by paragraph and character styles.
    I want to access the xml tag attribute of the xmltag, related to my first 5 characters....
    How to do it?
    Or second approch, i need to find first and last xml tag on the page.

    Try this (second approach),
    Select any text frame and try the below code:
    alert(app.selection[0].lines[0].words[0].associatedXMLElements[0].markupTag.name)\\first XML tag
    alert(app.selection[0].lines[-1].words[-1].associatedXMLElements[0].markupTag.name)\\second XML tag
    Vandy

  • Find inline objects and apply object styles...

    Hi Eveyone,
    I am trying to find placed inline rules and apply object styles through javascript. Because we need some baseline shift to those rules. I getting some error while find the rules. FInd the syntax below,
    app.findObjectPreferences=app.changeObjectPreferences=null;
    app.findChangeObjectOptions.properties =
      objectType: ObjectTypes.unassignedFramesType
    app.findObjectPreferences.strokeWeight=1;
    app.changeObjectPreferences.appliedObjectStyles=app.activeDocument.objectStyles.item("WOL" );
    app.activeDocument.item(0).changeObject();
    Can anyone look into this help for me. Thanks in advance.
    Regards
    Thiyagu

    Hi Dave,
    I have tried the script after removing "s" in it. Now i am getting error like "object doesn't support the property or method 'appliedObjectStyle'". Please look into this and help me out. Herewith i attached the 'error' dialog snapshot.
    When i tried this in loop its working fine. Find the script below.
    app.findObjectPreferences=app.changeObjectPreferences=null;
    app.findChangeObjectOptions.properties =
      objectType: ObjectTypes.unassignedFramesType
    app.findObjectPreferences.strokeWeight=1;
    myFindObj=app.findObject(true);
    for(i=0;i<myFindObj.length;i++){
        myFindObj[i].appliedObjectStyle=app.activeDocument.objectStyles.item("WOL");
    alert ("DONE!");
    Regards
    Thiyagu

  • Autogenerate XML tag names from other style palettes

    Map Styles to Tags works great when you already have a bunch of tags named identically to the other styles you want to map. Today, however,  I had to manually create and type in tag names to match about 25 paragraph styles. Ick!
    It would be really neat if you could select a bunch of styles in the Para or character Styles palettes and have a "Create Matching Tags" command that would automatically add tags matching those style names to your Tags list. No muss, no fuss, no typos.
    Thanks! The XML fuctions are mostly extremely cool!

    FYI, I am using
    Win Xp-SP2, CS5 7.0.3

  • Finding xml tags name

    Hello,
    I use: Node root=doc.getDocumentElement();
    to find root of XML and NodeList a=root.getChildNodes(); to find all his children. how can I find tag's name (age)?
    <age> 22</age>

    Well, in a, you have a NodeList. That list contains a lot of nodes. If age is the first (and/or only) node in that list, you probably can take a.item(0).getNodeName();
    Read more at http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Node.html and http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/NodeList.html

  • Use Conditional Tags to apply different Style Sheets / Skins for branding purposes?

    RoboHelp HTML > WebHelp layout appearance using Conditional Build Tags
    I have a customer who supplies an application to different corporates, and brands his product by changing the appearance, using a selected style sheet to suit the Brand.
    Is there a way to customise a WebHelp layout, to select a style sheet and a skin for Brand A, and another style sheet and skin for Brand B, and so on?
    Would this work in RH7? (The customer uses this at the moment.)
    Would this work in RH8? (They could upgrade if this solves the problem.)
    Philip Tory, Technical Author

    Hi Phillip
    RoboHelp 8 offers an ability to nominate a specific CSS file in the Single Source Layout recipe. So sure.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • How to apply multiple styles for nested tags in XML?

    Say you import this XML into InDesign:
    <Root>
      <strong>
        <em>Bolded and Italicized</em>
      </strong>
    </Root>
    And you have two character styles, bold and italics, to map to strong and em tags respectively.
    You will see that the text appears italicized not bolded and italicized as expected. Generally, only the innermost tag will get the style and will overwrite its parent styles.
    Notice the XML is generated dynamically and tags order is not enforced. Also, there's an additional underline tag that can be nested with these two.
    So far I have tried to use GREP styles (with paragraph styles), but these do not have effect in the XML tags.
    Other possible options not tried yet:
    Create new tags for every formatting combination. Not what I really want because I could en up with a lot of tags each one with a corresponding styles.
    Create InDesign XML rules to apply character styles automatically based on the tags
    Use character styles in the XML with the aid namespace referencing InDesign styles. Will this really work?
    What do you suggest to go for? See any other option?
    Thank you in advance.
    Juan

    I'd say that you should create tags not for appearances, but for semantic content. Specifying formatting styles in your XML betrays your lack of familiarity with the format, because the last thing you'd want to do would be to use HTML markup in the middle of your XML. If you have content that's supposed to be both bolface and oblique - say, a warning - then it's marked up as
    <warning>Never refer directly to formatting in your XML markup, only to content types!</warning>
    If I had a document that was written in the style you suggest - one with lots of overlapping local formatting - I'd look at developing a better style guide that told the writers that doing so would be bad form. Because, you know, many of the writers I deal with are addicted to forms of emphasis that do nothing useful whatsover for their readership - they only serve to overemphasize the authorial voice of the writers.
    Maybe you could tell us why you need these overlapping forms of styling, and we could suggest other InDesign formatting tools (like line styles or nested styles) that would help you get the appearance you want without crowding styling markup into your XML - where, strictly speaking, it doesn't really belong.

  • [CS5 JS] Problem in Applying character styles xml tag names

    Hi,
    e.g. 1
    <italic>This is a italic text with <sup>superscript value</sup></italic>
    e.g.2
    <sup>This is a superscript text with <bold>Bold superscript</bold></sup>
    <italic>  mapped to character style "italic" and
    <sup> mapped to character style "sup"
    In my java script I already mapped the xml tags to specific character styles. In some of the cases (see e.g.1 and e.g.2) I need to map it to other character styles.
    In e.g.1 I need to apply a new character styles "italicSup" for the text "superscript value" same way
    In e.g.2 I need to apply a new character styles "BoldSup" for the text "Bold superscript".
    Can any know how to do this?
    Green4ever

    FYI, I am using
    Win Xp-SP2, CS5 7.0.3

  • Assign paragraph-styles to xml-tags correctly. How to?

    Hi,
    I want to assign xml-tags to existing paragraph styles in InDesign CS6 on a Mac 10.6.8. The xml itself is organized like this:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <katalog>
    <artikel id="32434">
    <img href="/bilder/32434.tiff" />
    <artikeltextgruppe>
    <artikelmarke>DieselGabana</artikelmarke>
    <artikelheadline>Jeans ist super</artikelheadline>
    <artikeltext>Superjeans knallt rein.</artikeltext><artikelnummer>70238</artikelnummer>
    <artikelmaterial>100% Jeans</artikelmaterial>
    <artikelgroesse>Uni</artikelgroesse>
    <artikelfarbe>Uni</artikelfarbe>
    </artikeltextgruppe>
    </artikel>
    </katalog>
    By selecting the option "Assign formats per name to the tags" (translated from German) I wanted to generate the desired look. But if I start this all I get is the whole textblock of <artikeltextgruppe> assigned to 1 formatstyle. And besides that the whole content of <artikeltextgruppe> looks like one single paragraph without any structure (no linebreaks) The content though is correctly structured because I can highlight the value of e.g. <artikelmarke>separately by doubleclicking this tag in the structure-view.
    a) What can I do to assign the formats correctly AND to have correct linebreaks?
    b) If I drag my node <img href="/bilder/32434.tiff" /> iin the layout I get a message displayed to search again for the correct reference location. And that happens independently on using relative or absolute references (Although I need to use relative ones) What can I do here?
    thanks so much

    First, I would probably do a search and replace to remove the group element using a text editor (the <artikeltextgruppe> and </artikeltextgruppe> elements). They really are not needed.
    Second, I usually create my styles with the same names as the elements themselves. Then, after the XML is imported, I use the "map tags to styles" command from the Structure pane.
    I copied and pasted the single artikel element to create 4 records, added a varition of an image to each element record. Once the paragraph styles were mapped, your XML looked like this in a two column format (to get all 4 records on a page)...
    By default, ID will create a single line to a single line in the XML. So if you desire elements to be on their own line, the XML needs to be formatted that way. If you need different styling within a paragraph, you need to create character styles and alter the elements within an XML group and or paragraph and add the code in the XML accordingly or post process once inside of ID.
    I always need to take the XML I am given and reformat, move elements with the tree, change links to images, remove tabs and or spaces where I do not want them, tag for character styles, etc., to get close to how I want the initial format to be.
    Mike

  • Newbie trying to analyze code for xml tags

    My problem is that I need to find what xml tags my java files contain. Is there a way to run a search and pull out all xml tags? Thank you.

    you mean you have to find xml tags in .java file. you have to write a program that will read the contents of file and then check for any string that contains < and ends with >. U can use LineNumberReader class for reading a line. besides these u have to take care of comments.
    Regards,
    Gurpreet

  • Need to add xml tag in the request message

    Hello Experts,
    Need ur help.
    Right now i am working on the scenario Http -> to -> Proxy.
    Whatever request i am getting is not having XML tag in it, and because of that my mapping is failing.
    Can you tell me that how can i add XML tag in my request so it will not fail in Mapping?
    Need to add : <?xml version="1.0" encoding="UTF-8"?> in request.
    Thanks,
    Hetal

    HI Hetal
    Instead of adding this to the source message. Remove this tag from mapping.
    Use a XSLT mapping without this initial tag. it will work.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://namespace">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
    <xsl:template match="/">
    <xsl:for-each select="//tag">
    <xsl:value-of select="." disable-output-escaping="yes"/>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    Use this mapping without
    <?xml version="1.0" encoding="UTF-8"?>
    If you still see XML tag then use
    <xsl:output method="html"
    instead of
    <xsl:output method="xml"
    Thanks
    Gaurav

  • Applying a style wont add an effect

    Hello,
    usign FW8, if I create a style from an shape that has a
    shadow effect on it then applying that style to a new shape, the
    new shape will only render the fill and stroke colors and not any
    effects although the effect was marked and is displayed in the
    thumbnail under the styles pallet.
    is this how it should work?
    thanks,
    Mic

    migo33 wrote:
    > Hello,
    >
    > usign FW8, if I create a style from an shape that has a
    shadow effect on it
    > then applying that style to a new shape, the new shape
    will only render the
    > fill and stroke colors and not any effects although the
    effect was marked and
    > is displayed in the thumbnail under the styles pallet.
    It should render the shadow as well. Can you post your PNG
    file so we
    can have a look?
    Linda Rathgeber [PVII] *Adobe Community Expert-Fireworks*
    http://www.projectseven.com
    Fireworks Newsgroup:
    news://forums.projectseven.com/fireworks/
    CSS Newsgroup: news://forums.projectseven.com/css/

Maybe you are looking for

  • My ipod is not being read, but my sister's is and we have the same ipod

    I have a 2GB grey nano ipod and its not showing up on my computer or itunes, but it will still charge it. HOWEVER, my sister has the same ipod, and hers is able to be read by the same computer that i am using. I dont know what is wrong with my ipod??

  • Content to be rendered in Popup style in portal

    Hi All, I am trying to invoke a pop-up like behavior when I click on a link inside one of the portlet. Kevin had mentioned in one of the threads that the pop-up like style can be achieved using the DISC framework available in weblogic portal. But Im

  • I get an error message that the licensing isn't working

    I recently had a hard drive crash. I used my time machine back up to reinstall the program on my laptop however I get an error message when ever I try to open any app from CS4 that the licensing isn't working and I should contact customer support.

  • Control on a shape color.

    Hi fellows!! I drew a rectangle and converted it to a movieclip symbol.   My question is simply is there a way to control this movieclip fill/stroke color by using actionscript code.   Thanks in advance!!  Atar.

  • Photoshop Action from Bridge

    I have a bunch of PNG files that keep on showing up with no preview. Can't figure out why. But, I have figured out that if I open them in Photoshop and re-save them it fixes the preview. So, I did an action in Photoshop where I saved the file under t