Jump to content

XML - XSL


Guest anri

Recommended Posts

I have some problems with Hyper Linking in XMLI’m using XSL style sheet to present XML file.XML looks like this<root>…<employers><name>John</name><title>boss</title><hlink>http://www.john.com</hlink><name>Mike</name><title>Assistent</title><hlink>http://www.mike.com</hlink></employers>…</root>and there are other users…in XSL I’m using<table> <tr> <th align="left">Title</th> <th align="left" width="550">Name</th> </tr> <xsl:for-each select="root/employers"> <tr> <td>[Title] <xsl:value-of select="title"/></td> <td>[Name]<xsl:value-of select="name"/></td> </tr> </xsl:for-each> </table>that's all easy, but I got stuck with hyper linksHow should I apply <hlink> element to <name> via XSL? to make it look like:boss: John // if you click on 'John' it takes to http://www.john.comAssistant: Mike // if you click on 'Mike' it takes to http://www.mike.com and so on...seems to be easy... but I don't know how toif you know how to please let me know! thanks in advance!

Link to comment
Share on other sites

<table><tr><th align="left">Title</th><th align="left" width="550">Name</th></tr><xsl:for-each select="root/employers"><tr><td>[Title] <xsl:value-of select="title"/></td><td>[Name]<a><xsl:attribute name="href"><xsl:value-of select ="hlink"/></xsl:attribute><xsl:value-of select="name"/></a></td></tr></xsl:for-each></table>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...