Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSL HELP!!

From: GaneshMuthuvelu@-----------.---------.---
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/
> 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent