Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use xsl to create HREFs in an xml document

Status
Not open for further replies.

VBGuy2112

Programmer
Feb 19, 2002
58
US
I am looking to use an .xsl document to make all instances of the following tag example:
<folder name=&quot;Documentation&quot;>

show up as a hyperlink in my xml document. So I want &quot;Documentation&quot; to show up as a hyperlink in this example. I'm stumbling through this and so far have:

<xsl:stylesheet xmlns:xsl=&quot;test.xml&quot; version=&quot;1.0&quot; >
<xsl:template match=&quot;folder name&quot;>
<xsl:for-each select=&quot;folder name&quot;>
<xsl:attribute name=&quot;href&quot;><xsl:value-of select=&quot;Url&quot;/>
</xsl:attribute>
<xsl:value-of select=&quot;Description&quot;>
</xsl:value-of>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


I'm very new to xml & xsl so please excuse any stupidity on my part!

Thanks.
 
<xsl:template match=&quot;folder&quot;>
<a href=&quot;{name}&quot;>
<xsl:value-of select=&quot;Description&quot;/>
</a>
</xsl:template>

if you don't understand anything just ask :)
 
Thanks for the reply. I'm not getting anything when I bring up my document in explorer though.

This is my document I'm trying to format:

<?xml version=&quot;1.0&quot;?>
<?xml-stylesheet type=&quot;text/xsl&quot; href=&quot;test.xsl&quot;?>
<drive name=&quot;C&quot;><folder name=&quot;DirectoryTree&quot;><folder name=&quot;Icons&quot;><folder name=&quot;Icons1&quot;/><folder name=&quot;Icons2&quot;><folder name=&quot;Sub1&quot;/><folder name=&quot;Sub2&quot;/></folder><folder name=&quot;Icons3&quot;/><file>MISC44.ICO</file></folder><folder name=&quot;Test&quot;><folder name=&quot;Test1&quot;/><folder name=&quot;Test2&quot;/><folder name=&quot;Test3&quot;/></folder><file>DirectoryTree.exe</file><file>DirectoryTree.vbp</file><file>DirectoryTree.vbw</file><file>frmMain.frm</file><file>frmMain.frx</file><file>MSSCCPRJ.SCC</file></folder></drive>

Do you know what else I'm doing wrong?
 
You can try the following xsl code..
You can send parameters to the page that you are referring in the following fashion.
&quot;Inputparam&quot; is the parameter and its value will be
that of ITEMNO .

<xsl:attribute name=&quot;href&quot;> select=&quot;@ITEMNO&quot;/></xsl:attribute>

If you find any problems then let me know..

Hope this helps..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top