Using a variable in a output element
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 269
- Joined: Sat Jul 10, 2010 4:03 pm
Using a variable in a output element
I have a simple function to output a <span/> tag . One of the <span/> attributes uses a param of the template.
The param is id, referenced in the url attribute as $id, since its in a string "taxonomy/mbe_persons1.html?refid=($id)" is is hidden and doesn't evaluate as a variable.
If I try to use the <xsl:value-of select="$id"/> in place of $id, the parser complains about using the <> characters in the url attribute.
anybody know of a way around this?
thanks, Scott
The param is id, referenced in the url attribute as $id, since its in a string "taxonomy/mbe_persons1.html?refid=($id)" is is hidden and doesn't evaluate as a variable.
If I try to use the <xsl:value-of select="$id"/> in place of $id, the parser complains about using the <> characters in the url attribute.
Code: Select all
<xsl:template name="personPageLink">
<xsl:param name="id"/>
<p><span class="addDocTab" url="taxonomy/mbe_persons1.html?refid=($id)" title="Click to see more letters" rel="People References">See more letters.</span></p>
</xsl:template>
thanks, Scott
-
- Posts: 9421
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Using a variable in a output element
Hi Scott,
You can probably do something like:
Using "{" and "}" in attribute values allows you to add xpath expressions there.
Or you can re-write the entire span in XSLT like:
Regards,
Radu
You can probably do something like:
Code: Select all
<span class="addDocTab" url="taxonomy/mbe_persons1.html?refid=({$id})" title="Click to see more letters" rel="People References">See more letters.</span>
Or you can re-write the entire span in XSLT like:
Code: Select all
<xsl:element name="span">
<xsl:attribute name="class">addDocTab</xsl:attribute>
<xsl:attribute name="url" select="concat('taxonomy/mbe_persons1.html?refid=(', $id, ')')"/>
<xsl:attribute name="title">Click to see more letters</xsl:attribute>
<xsl:attribute name="rel">People References</xsl:attribute>
See more letters.
</xsl:element>
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
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