• 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

It's boring, XSLT ...

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to use XSLT to format xml, follows with my xml file and xsl file
XML
...
<root>
<user>
<user_id>27</user_id>
<name>John</name>
</user>
......
</root>
XSL file
<xsl:template match="/">
<xsl:for-each select="root/user">
<tr>
<td><a href=" put code here "><xsl:value-of select="Title"/></a></td>.....Line (4)
<td><xsl:value-of select="name"/></td>
</tr>
</xsl:for-each>
</xsl:template>
In line 4 of xsl file , I want to put value of <xsl:value-of select="user_id"/> into html link, just href="<xsl:value-of select="user_id"/>"
I tried several methods to do it, anyone didn't work successfully.
How to put the value into href attribute within tag a???
Please help ....
Thanks in advance.
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try using <xsl:attribute>. An example,
<a>
<xsl:attribute name="href"><xsl:value-of select="user_id"/></xsl:attribute>The title part</a>
Hope this helps!
 
Pay attention! Tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic