Dynamic XSLT Output path
Oxygen general issues.
-
- Posts: 1
- Joined: Thu Mar 10, 2011 7:34 pm
Dynamic XSLT Output path
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
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
-
- Posts: 2
- Joined: Fri Mar 11, 2011 5:18 pm
Re: Dynamic XSLT Output path
Post 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.
<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.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Dynamic XSLT Output path
Post by sorin_ristache »
Hello,
Regards,
Sorin
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: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.
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
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Dynamic XSLT Output path
Post by sorin_ristache »
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.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?
Regards,
Sorin
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service