Page 1 of 1
Dynamic XSLT Output path
Posted: Thu Mar 10, 2011 7:56 pm
by LesleyO
I'm quite new to Oxygen, so please be kind if this is something simple I've missed.
I'm performing an xslt transformation on the file at
projectname/PAL/content/science/organisms/life/revise.xml
and want to output the file at
projectname/PAL/output/science/organisms/life/revise.xml
Anything after /content/ is a varying content structure of subjects/topics and I need the output files to mirror this. I can't see a way of achieving this using 'Edit scenario -> Output file' using Editor Variables. Is there a way of defining a dynamic output path rule, or using xslt functions (eg substring-after) in Editor Variables?
Thanks
Re: Dynamic XSLT Output path
Posted: Fri Mar 11, 2011 6:19 pm
by tom_maslen
In a 'Transform Scenario' you can use XSLT code to set parameters that are passed into the transform, e.g. ...
<xsl:choose>
<xsl:when test="$fop.extensions != 0">0pt</xsl:when>
<xsl:when test="$passivetex.extensions != 0">0pt</xsl:when>
<xsl:otherwise>4pc</xsl:otherwise>
</xsl:choose>
If it was possible to set Custom Editor Variables in the same way, Leslie would be able to set a variable like this (maybe):
<xsl:value-of select="string-before(${cf}, 'content')" />output<xsl:value-of select="string-after(${cf}, 'content')" />
Does anyone know if this is possible?
Thanks,
Tom Maslen.
Re: Dynamic XSLT Output path
Posted: Fri Mar 11, 2011 6:59 pm
by sorin_ristache
Hello,
LesleyO wrote:I'm performing an xslt transformation on the file at
projectname/PAL/content/science/organisms/life/revise.xml
and want to output the file at
projectname/PAL/output/science/organisms/life/revise.xml
Anything after /content/ is a varying content structure of subjects/topics and I need the output files to mirror this.
You could do it by setting (in the transformation scenario) the output URL to be the same as the input XML URL (that means setting the
editor variable ${cf} -
current input XML
file - as the
Save As value in the scenario) and rewriting (with an
XML catalog) the
projectname/PAL/content/ prefix of the URL as a
projectname/PAL/output/ prefix. That will rewrite any URL that starts like (for example)
file:///C:/projectname/PAL/content/ to a URL that starts with
file:///C:/projectname/PAL/output/. An example of XML catalog for you:
Code: Select all
<?xml version="1.0"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI
uriStartString="file:///C:/projectname/PAL/content/"
rewritePrefix="file:///C:/projectname/PAL/output/"/>
<rewriteSystem
systemIdStartString="file:///C:/projectname/PAL/content/"
rewritePrefix="file:///C:/projectname/PAL/output/"/>
</catalog>
Regards,
Sorin
Re: Dynamic XSLT Output path
Posted: Fri Mar 11, 2011 7:04 pm
by sorin_ristache
tom_maslen wrote:If it was possible to set Custom Editor Variables in the same way, Leslie would be able to set a variable like this (maybe):
<xsl:value-of select="string-before(${cf}, 'content')" />output<xsl:value-of select="string-after(${cf}, 'content')" />
Does anyone know if this is possible?
Editor variables are available only as GUI helpers for setting file paths like the input file or output file of the transformation or an
external tool, the schema of a
validation scenario, etc.. They are not processed and expanded in XSLT stylesheets.
Regards,
Sorin