Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Simple question about XSL and XML [Thread Next] Re: Simple question about XSL and XMLTo: NULL Date: 6/7/2007 6:24:00 PM
<roassaf@g...> wrote in message
news:1181236570.827851.21270@g......
On Jun 6, 9:54 pm, "toudidel" <x...@neostrada.pl> wrote:
> U¿ytkownik <roas...@gmail.com> napisa³ w
> wiadomoocinews:1181152677.588992.118820@i......
>
> > <money>
> > <money-site url="www.yahoo.com"> Yahoo finance </money-site>
> > <money-site url="www.cnn.com"> CNN finance </money-site>
> > </money>
> > How can I retrieve the value of the url and put it inside the href
>
> <xsl:apply-templates match="/money/money-site"/>
> ...
> <xsl:template match="money-site">
> <a href="{@url}"><xsl:value-of select="."/></a>
> </xsl:template>
>
> --
> tdwww.paranoja.org
Hi,
Thanks for the quick answer.
I have a follow up question:
If I have a case where I don't get the URL only the name of the
website and then I want to display it with no url.
Is there any condition for me to check if the url exists (when it is
in the form of the example above).
Thanks
Well you can test:
<xsl:template match="money-site">
<xsl:choose>
<xsl:when test="@url">
<a href="{@url}"><xsl:value-of select="."/></a>
</xsl:when>
<xsl:otherwise>
<div>xsl:value-of select="."/></div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
--
Joe Fawcett (MVP - XML)
http://joe.fawcett.name
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
