Groups | Blog | Home
all groups > dotnet xml > september 2003 >

dotnet xml : Dynamic <a> links in xslt output


Ron Vecchi
9/27/2003 8:48:05 AM
I'm pretty new to XSLT so bear with

I have an XML file that contains Names and ID's of a bunch of widgets.
Using XSLT I would like to output an <A> link with the Widget's ID as part
of the query string. <a href="myWidget.aspx?ID=WidgetID">WidgetName</a>

I am having a hard time figuring out how to get the WidgetID inside of the
href link.
I can do everything else as far as get the Name between my links but that
seems like the easy part. Having trouble finding resources that explain
this. I was thinking about using variables but from my understanding a
variable cannot be manipulated after its initial assignment. So this would
not work past the first Widget.



XML
--------------------------
<Widgets>
<Widget>
<WidgetID>1000tr</WidgetID>
<WidgetName>SuperWidget</WidgetName>
</Widget>
<Widget>
<WidgetID>1330tr</WidgetID>
<WidgetName>SuperDuperWidget</WidgetName>
</Widget>
</Widgets>



Thanks

Ron Vecchi


Oleg Tkachenko
9/27/2003 7:05:47 PM
[quoted text, click to view]

<a href="myWidget.aspx?ID={WidgetID}"><xsl:value-of
select="WidgetName"/></a>

See http://www.w3.org/TR/xslt#attribute-value-templates
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel
AddThis Social Bookmark Button