how to use XSL
I have an XSL that I am using during an XML transformnode()
an XML fragment is something like
<retailer>
<index>1</index>
<name>My Store</name>
</retailer>
I would like to generate the following HTML
<a href="mypage.asp?retailid=1>My Store</a>
I tried...
<a>
<xsl:attribute name="href=mypage.asp?retailid">
<xsl:value-of select="index"/>
</xsl:attribute>
<xsl:value-of select="name"/>
</a>
But this resulted in...
<a href="mypage.asp?retailid="1">My Store</a>
How can I get rid of the "" around the id number?
TIA,
Phil
# 1 Re: how to use XSL
Phil,
Try this
<a>
<xsl:attribute name="href">
"mypage.asp?retailid="<xsl:value-of select="index"/>
</xsl:attribute>
<xsl:value-of select="name"/>
</a>
This should work.
<xsl:attribute ..> tag is meant to declare the properties of the tag ("href")
like name etc. the value you want the attrib to contain should exist in between
those
<xsl:attribute ..> and <xsl:attribute/>
Rohit
# 2 Re: how to use XSL
Rohit,
Thanks for the advice. Your solution did remove the quote marks, however,
now the output is ...
<a href="mypage.asp?retailid= 1">My Store</a>
If you can't see it here, I have the index number 1 preceded by 32 spaces.
Anyway to trim these spaces during the transformation?
Thanks again,
Phil
"Rohit Wason" <rohitw@futuresoftindia.com> wrote:
>
>Phil,
>Try this
>
><a>
> <xsl:attribute name="href">
> "mypage.asp?retailid="<xsl:value-of select="index"/>
> </xsl:attribute>
> <xsl:value-of select="name"/>
></a>
>
>This should work.
>
><xsl:attribute ..> tag is meant to declare the properties of the tag ("href")
>like name etc. the value you want the attrib to contain should exist in
between
>those
><xsl:attribute ..> and <xsl:attribute/>
>
>Rohit