InDesign and xml

gtrmke

New member
Hi all, I need some help with xsl. I have a supplied xml file that needs some massaging via xsl before I can import it into InDesign. Reason being is there are many elements with the same name but what is unique is the name attribute.

I want to rename the element the value of the name attribute.

For the life of me I cannot get the for-each loop to work so it has been omitted from the xsl.

Below is a sample of xml...

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="source.xsl"?>
<Root>
<Data description="Data Area 1" name="Data_1">
123456</Data>
<Data description="Data Area 2" name="Data_2">
987654</Data>
</Root>

and the xsl...
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:eek:utput omit-xml-declaration="yes" />
<xsl:template match="Data">
<xsl:variable name="att1" select="@name" />
<xsl:element name="{$att1}">
<xsl:apply-templates />
</xsl:element>
</xsl:template>
</xsl:stylesheet>

I've also attached a zip file that contains the xml and xsl files.

Thanks in advance for any help

Mike
 

Attachments

  • xml_xsl.zip
    1.2 KB · Views: 225

PressWise

A 30-day Fix for Managed Chaos

As any print professional knows, printing can be managed chaos. Software that solves multiple problems and provides measurable and monetizable value has a direct impact on the bottom-line.

“We reduced order entry costs by about 40%.” Significant savings in a shop that turns about 500 jobs a month.


Learn how…….

   
Back
Top