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

Testing type of a param

Subject: Testing type of a param
From: Robin Meade <rmeade@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 May 2001 18:13:09 -1000
 Testing type of a param
A param's type can be any of

  string, number, boolean, node-set

Within a called template I'd like to be able use <xsl:choose> to 
branch based on whether a parameter is a node-set or not.

Is there a way to do this?

FYI, here is the template I'm trying to write; it is a general 
purpose repeat function:

<!--
  This template takes two parameters:
    value - the thing to repeat.
    n - the number of times to repeat it to the result tree.
  If value is a node set, xsl:copy-of is used.
  If value is a simple value, xsl:value-of is used.
  -->
<xsl:template name="repeat">
  <xsl:param name="value"/>
  <xsl:param name="n"/>
  <xsl:if test="$n != 0">
    <xsl:choose>
      <xsl:when test="?"> 
        <!-- value is a node set, use copy-of -->
        <xsl:copy-of select="$value"/>
      </xsl:when>
      <xsl:otherwise>
        <!-- value is a simple type, use value-of -->
        <xsl:value-of select="$value"/>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:call-template name="repeat">
      <xsl:with-param name="n" select="$n - 1"/>
      <xsl:with-param name="value" select="$value"/>
    </xsl:call-template>
  </xsl:if>
</xsl:template>

 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.