[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: parameter problem

Subject: RE: parameter problem
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Fri, 3 Aug 2001 10:41:24 +0100
RE:  parameter problem
> Now my problem is that I want to take the input regarding
> which element to
> replace & by which element ,from user as parameters.I am
> facing problem as I
> can't assign a parameter value to <xsl:template match> option .
> for eg <xsl:template match="{$foo}">.

Unfortunately you can't use a parameter in the match pattern. So it has to
be:

<xsl:template match="*">
  <xsl:choose>
     <xsl:when test="name()=$p1">
       <xsl:element name="{$p2}">
         <xsl:copy-of select="@*"/>
         <xsl:apply-templates/>
       </xsl:element>
     </xsl:when>
     <xsl:otherwise>
       <xsl:copy>
         <xsl:copy-of select="@*"/>
         <xsl:apply-templates/>
       </xsl:copy>
     </xsl:otherwise>
  </xsl:choose>
</xsl:template>

Take care with namespaces: how do you want the user to specify the parameter
if the element names are namespace-qualified?

Mike Kay
Software AG


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.