Importing xml with xslt in InDesign CS4

Hello All,
i need someone's help who's an expert at xml and xslt features of InDesign CS4.
i work in publication, besides our magazines we produce yearbooks with lots of repetative information fields in them. we get the data in xml fromat which we flow in to InDesign. the xml files are very simple, here's an example:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<Root>
<Story>
      <Country> Afganistan </Country>
<Company_ID>
   <Company_Name> Kam Air </Company_Name>
   <Company_Code> 1 </Company_Code>
   <Address_text> 1205 Qalla Fatuha </Address_text>
   <Address_text> P.O.Box 456 </Address_text>
   <Address_text> Kabul </Address_text>
   <Address_text> 22004 </Address_text>
   <Address_text> Afganistan </Address_text>
   <Telephone_text> Telephone: +93 20 2200 108 </Telephone_text>
   <Fax_text> Fax: +93 20 2200 110 </Fax_text>
   <Email_text> E-mail: [email protected] </Email_text>
   <Website_text> Website: www.flykamair.com </Website_text>
   <Personel_text> Abdul Raquib, chief Executive <Personel_text>
   <Personelmail_text> ([email protected]) </Personelmail_text>
   <Job_code> A1 </Job_code>
</Company_ID>
     <Country> Albania </Country>
etc.
</Story>
</Root>
the problem is we don't want <Company_Code> and <Job_code> elements displayed in the InDesign file.
so we created an xslt file that shoud get rid of these two unwanted elements (obviously the xml file above was pointed to this xslt file)
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<Root>
<Story>
  <Country>
<xsl:for-each select="Company_ID">
   <Company_ID>
      <xsl:value-of select="Company_Name"/>
      <xsl:value-of select="Address"/>
      <xsl:value-of select="Telephone_text"/>
      <xsl:values-of select="Fax_tex"/>
      <xsl:value-of select=Email_text"/>
      <xsl:value-of select="Website_text"/>
      <xsl:value-of select="Personel_text"/>
      <xsl:value-of select="Pesronelmail_text"/>
   </Company_ID>
  </xsl:for-each>
</Story>
</Root>
</xsl:template>
</xsl:stylesheet>
but it doesn't work. could someone tell me what's wrong with the xslt file? or what would the correct xslt file look like?
Thanks everyone!

Here's the sort of thing I mean in more detail.
First, the XML file:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<?xml-stylesheet type="text/xsl" href="transform2.xsl"?>
<Root>
<Country>
<Country_name>Afganistan</Country_name>
<Company_ID>
   <Company_Name> Kam Air </Company_Name>
   <Company_Code> 1 </Company_Code>
   <Address_text> 1205 Qalla Fatuha </Address_text>
   <Address_text> P.O.Box 456 </Address_text>
   <Address_text> Kabul </Address_text>
   <Address_text> 22004 </Address_text>
   <Address_text> Afganistan </Address_text>
   <Telephone_text> Telephone: +93 20 2200 108 </Telephone_text>
   <Fax_text> Fax: +93 20 2200 110 </Fax_text>
   <Email_text> E-mail: [email protected] </Email_text>
   <Website_text> Website: www.flykamair.com </Website_text>
   <Personel_text> Abdul Raquib, chief Executive </Personel_text>
   <Personelmail_text> ([email protected]) </Personelmail_text>
   <Job_code> A1 </Job_code>
</Company_ID>
<Company_ID>
   <Company_Name> Another Company </Company_Name>
   <Company_Code> 2 </Company_Code>
   <Address_text> Elswhere</Address_text>
   <Address_text> P.O.Box 123</Address_text>
   <Address_text>Another City</Address_text>
   <Address_text> 22005 </Address_text>
   <Address_text> Afganistan </Address_text>
   <Telephone_text> Telephone: +12345678 </Telephone_text>
   <Fax_text> Fax: +12345678 </Fax_text>
   <Email_text> E-mail: [email protected] </Email_text>
   <Website_text> Website: www.dfhdfh.com </Website_text>
   <Personel_text> dfhdfhdfhdfhdfh</Personel_text>
   <Personelmail_text>dfhdfhdfhdfh</Personelmail_text>
   <Job_code> A2 </Job_code>
</Company_ID>
</Country>
     <Country>
<Country_name>Albania</Country_name>
<Company_ID>
   <Company_Name> Number 3 </Company_Name>
   <Company_Code>3</Company_Code>
   <Address_text>Somewhere in Albania</Address_text>
   <Address_text>Freedonia Avenue</Address_text>
   <Address_text>Whatever the captial of Albania is called</Address_text>
   <Address_text> 88888</Address_text>
   <Address_text> Albania </Address_text>
   <Telephone_text> Telephone: + 666 666 666 666 </Telephone_text>
   <Fax_text> Fax: + 777 777 777 777</Fax_text>
   <Email_text> E-mail: [email protected] </Email_text>
   <Website_text> Website: www.albaniar.com </Website_text>
   <Personel_text>Ludwig Wittgenstein, chief Executive </Personel_text>
   <Personelmail_text> ([email protected]) </Personelmail_text>
   <Job_code> A1 </Job_code>
</Company_ID>
</Country>
</Root>
Note that I have renamed the XSL file "transform2.xsl". I have got rid of the "Story" tag, and I have nested the tags more appropriately, with a new tag "Country_name". Here's the XSL:
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<Root>
<xsl:for-each select="/Root/Country">
<Country>
<Country_name><xsl:value-of select="Country_name"/></Country_name>
<xsl:for-each select="Company_ID">
<Company_Name><xsl:value-of select="Company_Name"/></Company_Name>
<Address_text><xsl:value-of select="Address_text"/></Address_text>
<Telephone_text><xsl:value-of select="Telephone_text"/></Telephone_text>
<Fax_text><xsl:value-of select="Fax_text"/></Fax_text>
<Email_text><xsl:value-of select="Email_text"/></Email_text>
<Website_text><xsl:value-of select="Website_text"/></Website_text>
<Personel_text><xsl:value-of select="Personel_text"/></Personel_text>
<Personelmail_text><xsl:value-of select="Personelmail_text"/></Personelmail_text>
</xsl:for-each>
</Country>
</xsl:for-each>
</Root>
</xsl:template>
</xsl:stylesheet>
(That file should be saved as "transform2.xsl" to match the link on line 2 of the XML.)
Hope that works -- Jeremy

Similar Messages

  • Import XML, apply XSLT and embed images

    Hi everyone. I've been looking for days now about a way to export the content of a website as XML and import it then into InDesign, involving some basic text formatting and maybe links, lists and tables. Getting a XML version of a website isn't actually the problem. But including some InDesign readable formatting structure caused me some headache.
    First of all, I used InDesign from CS2 and read a lot about INX structure, XML Namespaces and Tagged Text. None of what I did seemed to result in any acceptable or properly working import. So I've read about CS3 having a new feature of applying XSL Stylesheets when importing a XML file and finally downloaded a trial version to test this out. Problem is, I can't find any helpful documentation on how to use this feature right. Neither in the web nor in your forums.
    So how does a XSL file have to look like in order to import XML with some basic formatting?
    Let's say the XML looks like this, very simple:
    ] <?xml version="1.0" encoding="UTF-8"?>
    ] <?xsl-stylesheet type="text/xsl" href="style.xsl"?>
    ] <root>
    ] <text>
    ] <bold>This text is bold</bold> and <italic>this seems to be italic</italic>.
    ] </text>
    ] <underline>I'm under the line</underline>
    ] </root>
    How does my XSLT code in "style.xsl" have to look like in order to tell InDesign that the content of <bold> has to be bold, the one of <italic> italic and leaving <underline> underlined?
    I tried placing Tagged Tags around the content with XSL but this just resulted in errors or plain text output in InDesign. I also tried to understand the magical code structure of INX, but left it behind until I recognized how complex it is.
    Until now, only Tagged Tags do what they shall do for me. Only problem is, the file with this Tagged Tags has to be TXT, but I want XML. Isn't there any way to apply a XSL file over a XML file and replace the XML tags with some Tagged Tags, and finally import everything successful into InDesign? I tried something like that and told the XSL to output the file as Text with
    i <xsl:output method="text" />
    but InDesign replies with an error as "text" is not valid for DOM structuring.
    Moreover, another problem is with importing images without having them saved on the local machine. Meaning, how to send images embed in XML files?
    Here I also tried many things like <![CDATA[base64-code-here]]> and so on, but never happened to tell InDesign that it has to do something with this code instead of just displaying it. Using
    i <image href="data:image/jpeg;base64,base64-code-here" />
    or anything alike didn't work at all.
    In the end, I want to allow downloading a XML version of the viewed site on my website which can be imported into InDesign with all basic formatting used on the site itself. Getting the XML file prepared is just a matter of some PHP scripting. Now I only have to know what InDesign can actually read, and of course, if InDesign is even able to do anything of what I've planned.
    I hope someone can help me.
    Thank you very much in advance, Dan

    XSL will re-arrange incoming XML so that you can flow the XML into an InDesign document that may be arranged differently than the incoming XML file.  You still need to set up tags and associate those tags with styles in order to achieve what you want.  You can use Maivald's "A Designer's Guide to Adobe InDesign and XML: Harness the Power of XML to Automate your Print and Web Workflows" as a starting point, but you will need to play with the pieces to figure it out.<br /><br />For your simple example, you will need to set up tags in text frames for <bold> and <italic>, create paragaph (or object) styles of [bold] and [italic] and then associate those styles with the tags.  Only then can you import the XML file and have things work.  InDesign has no pre-defined knowledge of what any XML tag means, even when the meaning seems obvious.  You are free to define your <bold> XML tag to mean italic text, for example.<br /><br />Though I've read through the Maivald book and converted a Spanish cookbook to English (as a gift for my mom), I am not by any means overly knowledgeable here.  It could well be that there are many ways to achieve the goal and I only know one, lol.<br /><br />Hope this helps.

  • Importing Word Docs(2007) into InDesign CS4 problem

    Well, I am creating a users guide in CS4 InDesgin, and I have a Word 2007 doc with tables in it, about 6 pages total, when I try to import that file, the whole InDesign freezes up and does not respond. When I have imported docs before, I had no issue? Is there something I am not doing? or is there a bug that I don't know about?
    Thanks
    Brian Watson
    [email protected]

    Well, I just accidently figured it out.. in Word 2007, if you save it as .docx is when I have the issue of InDesign freezing up and having to shut it down and restart InDesign. However, if I saved Word file as 97-2003 file .doc then no problem importing.. Thanks anyhow.. I hope this helps other folks..

  • Export/import text with all styles (indesign CS3 (XP SP2))

    I'm looking for the best way to export text so authors can edit their text using MS Word, Excel or xml. (they don't want to use Indesign). after they are done editting I want to import the text back into Indesign (with par, char, obj styles).
    I know how to import/export to .doc with styles, but this doesn't work for table, object styles, and page breaks.
    Xml tags or plugin/software might be a solution.
    I've searched the forums, google and read the help file, but still don't know what the best/quickest solution might be. ... ?
    thanks in advance

    1. Those programs don't support every feaature of InDesign, so you are out of luck.
    2. If they don't want to use InDesign, ask them to use InCopy, that is the only one programm which supports the whole InDesgin-functionlity
    3. Page breaks should never be done manually, never in Word, neither with InDesign. They should be created via paragraph styles in both program, but with the import options is a checker to get Word's page breaks.

  • Importing XML with html style tags

    I have an xml with an element <description> that contains some styling like, <em> or <b>. What do I need to do in order for me to import the xml into ID and see the italicized words?
    I appreciate any help.

    I have an xml with an element <description> that contains some styling like, <em> or <b>. What do I need to do in order for me to import the xml into ID and see the italicized words?
    I appreciate any help.

  • Problems with fonts in indesign cs4

    I have the problem with using the font Arial Narrow bold and Helvetica and maybee there is more fonts.
    Im using windows 7 64 bit, and installing the font as it should be.
    But it dosnt show op when it works with indesign cs4 / illustrator / photoshop.
    But it works fine with word.
    Can it be a installingproblem or ??
    mvh. Mr. Mox

    Hi Peter
    Thanks for trying to help.
    I have installed the file from your link. And there is no issues with the windows.
    Is there a hotfix for Adobe cs4. The fonts works ok with word program.
    I have just change the computer ( with windows xp  and  there was no problems. And now its installed with windows 7 64 bit.
    And therefore installed and reactivated the Adobe programs
    mvh. Mr Mox

  • Can you import xml index markers into InDesign?

    My tech writer is putting index markers in the xml as he writes. Is there a way to import the xml and InDesign recognize the xml index markers?

    We are having the same issue and haven't been able to find a solution.  Ideally we would like to import the XML into an InDesign layout with XML markup that would be interpreted by InDesign as an index item and would then create the appropriate index term.  Does anyone know if this type of XML feature is supported?
    Thanks,

  • Create XML with XSLT help

    Hi,
    I would like to create an XML which map to XSLT.
    The data that I have to produce XML is just a very small data, for example ArrayList<Integer> myList.
    So I need to create an XML from myList.
    I'm not sure what technology solution I should choose.
    But it'll be great if I can produce my XML map with my xslt.
    Should I use SAX? Xerces? Digester? or ....
    Could someone give me a right direction or an example.
    I'm really appreciate all your input.
    Thanks,

    Explain why you want to use XSLT. From what you've said so far I don't see the need.
    There are a variety of ways to produce XML from data. You'll need to decide how exactly you want a list of numbers to map to XML -- there's a lot of data missing here.

  • Problems with tables in InDesign CS4

    Since recently upgrading to CS4, I’ve been having issues with editing strokes in tables. The problem occurs after working on a table for a while-- where at first I’m able to edit stroke color and weight fine, but then after a period of time it becomes buggy and I’m no longer able to make further edits to the column/row strokes, such as not being able to set the stroke color to none. The only partial work around I’ve found is to quit InDesign and re-launch, then reopen the document, at which point I can then edit the table strokes—but only for awhile until the problem begins again and I have to repeat the process of quitting and restarting. I was wondering if anyone else has had a similar issue and might know of a fix (or better work around), or if it’s a known bug in CS4. I never remember this happening with table editing in CS3. Any help is greatly appreciated.

    I'm not fond of tables. Never been able to make table styles work correctly.
    My method for dealing with strokes is to selct the cell(s) and use the proxy in the control panel to set the stroke or strokes I want to edit, then change the attirbutes. I find sometimes I need to change the weight, other times the stroke type or even sometimes both. If you've applied a troke to one cell that is shared with another, then go to the other cell, I find you have to explicitly choose that stroke again to modify it.

  • How to import xml with data?

    Excel 2013
    i got an XML file generated by the GPinventory tool. when i import it into Excel, i only get the headers.
    how can i import the data as well?

    Hi,
    As far as I know, the GPinventory tool Supported Operating System :Windows 2000, Windows Server 2003, Windows XP, I suppose it generated XML file with Excel 2003 schema, but Excel 2013 have a new XML schema. This issue usually caused by the XML scheme.
    Please create a Excel 2013 schema XML file
    to test with Excel 2013, if the file could be import well. We'd better check the generated XML file.
    As a workaround, we'd better save the results as
    a tab-delimited text file and then import to Excel 2013.
    If this issue still exists, please upload the XML file through OneDrive. I want to test it.
    Regards,
    George Zhao
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help. If you have any feedback on our support, please click "[email protected]"

  • Importing xml with TOAD

    Hi,
    how to import table structure and data from xml file generated with Access 2003 using TOAD?

    Hi,
    how to import table structure and data from xml file generated with Access 2003 using TOAD?

  • Styling XML with XSLT Problem with javax.xml.transform???

    I have been trying to make a transformation and seem to be having a problem in that javax.xml.transform can not be found while using jdk1.3....If I use jdk1.4, there is no problem....
    Does anyone know how I can get things to work using jdk1.3???
    (Description of what I am doing...1) Building XML Source 2) Setting up the XSLT File 3) Building Source Object 4) Build Result Object 5) Transforming the Data.....MY RESULT SHOULD BE AN HTML PAGE)
    I have tried putting xerces.jar and xalan.jar in my CLASSPATH....but this still doesn't work....onyl thing that has worked is using jdk1.4 as my JAVA_HOME....
    PLEASE HELP!!!!

    PLEASE HELP....your advice here would be greatly appreciated.....

  • Importation PDF avec liens dans Indesign CS4

    Bonjour,
    Je n'arrive pas à importer certains liens d'un PDF dans Indesign.
    Dans le PDF, tout fonctionne bien.
    Mais lors de l’importation dans Indesign :
    les liens faisant référence à un site ou une adresse mail fonctionnent bien,
    ceux qui ont été créés dans le document (ayant généré le PDF) avec des signets ne fonctionnent pas.
    Je ne comprends pas pourquoi.
    Merci pour votre aide.

      Je vais fermer la discussion, car j'ai contourné le problème...
    J'ai beaucoup cherché sur internet parce que je voulais savoir pourquoi ces liens ne voulaient pas fonctionner.
    J'ai contrôlé au travers de ma palette liens si tout était correct.
    Voyant que c'était le cas, et n'ayant plus d'autres solutions, j'ai donc créé mes Hyperliens dans Indesign.

  • Import video with embedded subtitles - Premiere CS4

    I have a video with embedded subtitles. When you load a movie into Premiere CS4 preview I see subtitles. How to turn off the subtitles embedded in the film so that the exported movie did not have subtitles?

    How to convert RMVB files:
    http://www.jakeludington.com/dv_hacks/20051210_how_to_convert_rmvb.html
    -Jeff

  • Lion, Finder quits when copying a folder with idlk files (indesign cs4)

    I have a network volume on solaris which I backup folders to the local desktop. if I drag the folder to the desktop in lion, it gives permission issues once it gets to the idlk file, the finder resets, disconnects the network drive and does not copy. If i use snow leopard, the finder works fine and skips the the .idlk from all these guys having open files on the server. This is disruptive for my backups because often users have files open. How do i skip or ignore the .idlk files when I am backing up entire directories?

    This sounds like a Lion bug...File it with Apple...
    Can you use a tool other than the Finder to do the backup? Perhaps you could use an Applescript Droplet or something.
    Then you could try some other tool (perhaps 'ditto') to do the copy. Worst case you can copy the folder to a temporary location on the hard drive and then copy that copy to the Solaris server...

Maybe you are looking for

  • Material Description in Language key

    Hi all, Is it possible to enter more than one material description per language? Or Can I create another language key and enter more than one material description in additional data in material master? thanks.

  • IPOD NO LONGER MOUNTS/ CAN BE SEEN

    Hi, I'm sure there's a simple answer to this (hope so anyhow). I recently formatted my (third gen) mac formatted i-pod. I did this using a pc, though I did not use itunes to do this (I know, I know...). However, I obviously did something pretty serio

  • Problem in BAPI_BILLINGDOC_CREATEMULTIPLE(Create Billing Doc)

    Hi, While using the function module BAPI_BILLINGDOC_CREATEMULTIPLE which is used to create an invoice on providing the sales order as the input , I am able to get only a temporary invoice number called $00000001 but not able to get a final invoice nu

  • Acrobat 10.1.3 Word Crash when converting 2007 document to PDF.

    Word 2007 Crashes with the error seen below, when using the Convert to PDF button on the Acrobat ribbon in Word.  The document may have footnotes.  I can convert other docuemnts to pdf in this fashion.  Is there an issue converting Word Docuements to

  • Converting PDF to Word for Mac version 14

    I subscribed to PDF Export and tested it by converting a Word for Mac doc to a PDF and then opening same in Word. My font was Palatino regular. It opened alright, but Calibri was substituted for Palatino. How can I change this.