Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Why is this XML/XSL code not working? [Thread Next] Re: Why is this XML/XSL code not working?To: NULL Date: 11/1/2004 11:19:00 AM "Noel" <nospam@n...> wrote in message
news:%23iFQbU3vEHA.3580@T......
> Here's the actual code for XSL:
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0"><xsl:output method="xml"/>
>
> <xsl:param name="sortorder" select="'descending'"/>
> <xsl:param name="sortfield" select="'xxx'"/>
>
> <xsl:template match="/">
> <root>
> <xsl:for-each select="data" >
> <xsl:sort select="@*[name()=$sortfield]" order="{$sortorder}" />
> <data>
> <xsl:for-each select="@*" >
> <xsl:attribute name='{name()}'> <xsl:value-of
> select="."/></xsl:attribute>
> </xsl:for-each>
> </data>
> </xsl:for-each>
> </root>
> </xsl:template>
>
> <xsl:template match="data">
> <data>
> <xsl:apply-templates/>
> </data>
> </xsl:template>
>
> </xsl:stylesheet>
>
In your first template (match="/") data does not lie under /, it lies under
root. You need use ./*/root or add the
xmlns:sql='urn:schemas-microsoft-com:xml-sql' declaration to your stylesheet
and use sql:root/data.
--
Joe (MVP - xml)
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
