• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XSL Generating HTML

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,
I have an XSL file that generates HTML. The HTML file that is being generated has HREFs in it. How can I get the HREFS to equal the value of the XML attribute that it is transforming. For Example:
<body>
<xsl:for-each select="Locations/Location">
<a href="/servlet/GetMaps"><xsl:value-of select="Campus"/></a><br/>
</xsl:for-each>
</body>
Above, I would like "/servlet/GetMaps" really to be the value of "xsl:value-of select="Campus"/>".
This is driving me to drink!!!
Bob...
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not to discourage you from drinking , but you can use
<a href="{./servlet/GetMaps}">
construction
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you want to specify the attribute in the output HTML/XHTML, use {XPath}. This is the alternative way to get the value of XML note value using <xsl:value-of select="XPath"/>
 
Ranch Hand
Posts: 171
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The curly brackets are your friend. When you use them inside an attribute value, they will expand to the value of the XPath expression.
You didn't provide much context for your application; but maybe you want something like this:
<a href="{/servlet/GetMaps/@Campus}">fubar</a>
Results may vary.
Geoffrey
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic