Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: XSL HELP!! >Thread Next - Re: XSL HELP!! Re: XSL HELP!!To: NULL Date: 5/28/2008 7:48:00 AM
Thanks again.. This XSL does not produce the same result - I am trying to use
a variable for the element "UnixEmail". What's wrong?. Thanks.
******************
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="id" select="4"/>
<xsl:param name="element-name" select="UnixEmail"/>
<xsl:output method="xml"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:choose>
<xsl:when test="local-name() = $element-name">
<xsl:if test="@ID = $id">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
******************
"Martin Honnen" wrote:
> Ganesh Muthuvelu wrote:
>
> > Thanks for your help. I have one question on this. Is it possible to have a
> > variable name for the template "match"?.
> > The reason I am asking this is: The node "UnixEmail" is NOT static and may
> > change dynamically, for example, it could be even the "Domain" node..
> >
> > So, is it possible to have something like this n XSL:?
> >
> > <xsl:template match=@DynamicNodeName>
>
> No, that is not possible. With XSLT 1.0 you are not even allowed to use
> variables in match pattersn.
>
> With XSLT 2.0 you could use
> <xsl:param name="element-name" select="'UnixEmail'"/>
>
> <xsl:template match="*[local-name() eq $element-name]">
>
> There are currently three XSLT 2.0 processors, Saxon 9, AltovaXML, and
> Gestalt.
>
>
> With XSLT 1.0 you need to check inside of your template e.g.
> <xsl:template match="*">
> <xsl:choose>
> <xsl:when test="local-name() = $element-name">
>
>
> --
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
