XSL/XPATH compose string and use it as a variable name
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 12
- Joined: Wed Oct 31, 2007 1:25 pm
XSL/XPATH compose string and use it as a variable name
Hi guys,
there is something i needed many times. Is it possible to compose a string and use it to call an existing variable. XPath allways see only the string.
The the call:
there is something i needed many times. Is it possible to compose a string and use it to call an existing variable. XPath allways see only the string.
Code: Select all
<xsl:variable name="page-width-1">
<xsl:variable name="page-width-2">
...
<xsl:variable name="page-width-n">
Code: Select all
<xsl:variable name="result"
select="for $tab in $schr-tabs
<xsl:value-of select="concat('$', 'page-width-', '')">
-
- Posts: 12
- Joined: Wed Oct 31, 2007 1:25 pm
second try 
The call can be something like that:
or just
But this calls even don't work...

Code: Select all
<xsl:variable name="page-width-1">
<xsl:variable name="page-width-2">
...
<xsl:variable name="page-width-n">
Code: Select all
<xsl:variable name="result"
select="for $i in 1 to n
return concat('$', 'page-width-', '$i')">
Code: Select all
<xsl:value-of select="concat('$', 'page-width-', '2')">
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hello,
No, you cannot set a variable name dynamically in XSLT. You should use one variable and compose the value based on a condition.
Regards,
Sorin
No, you cannot set a variable name dynamically in XSLT. You should use one variable and compose the value based on a condition.
Regards,
Sorin
Return to “General XML Questions”
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