I'm working on an internal application that takes the output from a custom Excel spreadsheet, and creates a Final Cut Pro sequence in XML. Due to the way Excel handles nested repeating elements, I need to find a way to replace a dummy element I have created with a whole series of repeating elements. I could use a simple find and replace text editor method, but I would prefer to take care of everything in the xslt transform if possible. Any ideas?
Thanks!
My existing XSL (which just strips out the empty tags) is posted at the bottom.
The code is as follows.
Expand|Select|Wrap|Line Numbers
- <effect>
- <name>Text</name>
- <effectid>Text</effectid>
- <effectcategory>Text</effectcategory>
- <effecttype>generator</effecttype>
- <mediatype>video</mediatype>
- <parameter>
- <parameterid>str</parameterid>
- <name>Text</name>
- <value>Tuesday at 10:00</value>
- </parameter>
- <dummyattr>replace_me</dummyattr>
- </effect>
with the following (these are not variables, elements and data will always be the same):
Expand|Select|Wrap|Line Numbers
- <parameter>
- <parameterid>fontname</parameterid>
- <name>Font</name>
- <value>ITC Officina Sans</value>
- </parameter>
- <parameter>
- <parameterid>fontsize</parameterid>
- <name>Size</name>
- <value>39</value>
- </parameter>
- <parameter>
- <parameterid>fontstyle</parameterid>
- <name>Style</name>
- <value>1</value>
- </parameter>
- <parameter>
- <parameterid>fontalign</parameterid>
- <name>Alignment</name>
- <value>1</value>
- </parameter>
- <parameter>
- <parameterid>fontcolor</parameterid>
- <name>Font Color</name>
- <value>
- <alpha>255</alpha>
- <red>1</red>
- <green>2</green>
- <blue>3</blue>
- </value>
- </parameter>
- <parameter>
- <parameterid>origin</parameterid>
- <name>Origin</name>
- <value>
- <horiz>-0.101389</horiz>
- <vert>0.383604</vert>
- </value>
- </parameter>
Existing XSL:
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0"?>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output method="xml" indent="yes"/>
- <xsl:strip-space elements="*"/>
- <xsl:template match="node()//*">
- <xsl:if test="normalize-space(.)">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:if>
- </xsl:template>
- <xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>