Ignore previous one: How: Populate table of URLs from an XML using XSLT
This is a corrected posting. Please ignore my previous posting.
I just started XML. I searched for help for this problem but could not find
one specific to this.
This is the problem.
I have a an XML file with a list of URLs.
I could take that data and paint a simple HTML table using XSLT.
The problem occurs when I want the each URL to be present inside a quote
as a value for the HREF attribute to form an HTML anchor.
In other words how do I put URL part from XML using XSLT in the construct
below:
<A HREF="URL"> hello </A>
I know, the syntax isn't correct if I replace the URL part with <xsl: value-of
select="url">.
Then how do I "put" a value there?
Hope some one knows a way out.
Thanks,
Aaron
Re: Ignore previous one: How: Populate table of URLs from an XML using XSLT
"Aaron " <aaronsandy@yahoo.com> wrote in message
news:3aaffaa9$1@news.devx.com...
>
> In other words how do I put URL part from XML using XSLT in the construct
> below:
>
> <A HREF="URL"> hello </A>
There are two solutions:
1. <a><xsl:attribute name="href"><xsl:value-of
select="url"/></xsl:attribute>Link title</a>
2. <a href="{url}">Link title</a>
Re: Ignore previous one: How: Populate table of URLs from an XML using XSLT
I tried your solution. It just simply works.
Thanks you so much Russell.
"Russell Jones" <arj1@northstate.net> wrote:
>"Aaron " <aaronsandy@yahoo.com> wrote in message
>news:3aaffaa9$1@news.devx.com...
>>
>> In other words how do I put URL part from XML using XSLT in the construct
>> below:
>>
>> <A HREF="URL"> hello </A>
>
>
>There are two solutions:
>
>1. <a><xsl:attribute name="href"><xsl:value-of
>select="url"/></xsl:attribute>Link title</a>
>
>2. <a href="{url}">Link title</a>
>
>
>
Re: Ignore previous one: How: Populate table of URLs from an XML using XSLT
"Aaron " <aaronsandy@yahoo.com> wrote:
>
how do I put URL part from XML using XSLT in the construct
>below:
>
><A HREF="URL"> hello </A>
>
>I know, the syntax isn't correct if I replace the URL part with <xsl: value-of
>select="url">.
>
>Then how do I "put" a value there?
>
>Hope some one knows a way out.
>
>Thanks,
>Aaron
>
I might not be understanding the problem correctly but I'd do something like
the following
<xsl:template match="a"><a><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of
select="."/></a></xsl:template>
or you could, if you want to include a lot of html in your output, and of
course depending on parser used, declare your html as a namespace. I generally
don't like that however cause I think it decreases reusability of stylesheets
between media.