dynamic URL
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 12
- Joined: Tue Jun 14, 2005 6:40 pm
dynamic URL
Hi, I'm having a bit of an issue here... Basically, what I want to do is to dynamically generate the path where my output files will be created.
I have the following xml file :
What I tried to do is to create a variable with the correct hierarchy (in that case : "/dir1/dir2/dir3") using concat() inside a for-each tag, but the result is a local variable. What I need is a global variable so I can use it to determine where my output files will go.
Any help would be greatly appreciated.
I have the following xml file :
Code: Select all
...
<file>
<filename name abv="dir1">Directory 1</name >
<file>
<filename abv="dir2">Directory 2</name >
<file>
<filename abv="dir3">Directory 3</name >
</file>
</file>
</file>
...
Code: Select all
...
<xsl:for-each select="//file">
<xsl:variable name="currentFile" select="concat('/',filename/@abv)"/>
<xsl:variable name="Path" select="$currentFile"/>
</xsl:for-each>
...
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Having as input:
the following stylesheet
will give you
Best Regards,
George
Code: Select all
<file>
<filename abv="dir1">Directory 1</filename>
<file>
<filename abv="dir2">Directory 2</filename>
<file>
<filename abv="dir3">Directory 3</filename>
</file>
</file>
</file>
Code: Select all
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:variable name="path">
<xsl:for-each select="//file">
<xsl:text>/</xsl:text>
<xsl:value-of select="filename"/>
</xsl:for-each>
</xsl:variable>
<xsl:template match="/">
<xsl:value-of select="$path"/>
</xsl:template>
</xsl:stylesheet>
Code: Select all
/Directory 1/Directory 2/Directory 3
George
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ 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