Altova Mailing List Archives

[xsl] Testing type of a param

From: Robin Meade <rmeade@------------------->
Date: 5/15/2001 8:12:00 PM
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:when test="?"> 
        <!-- value is a node set, use copy-of -->
        <xsl:copy-of select="$value"/>
        <!-- value is a simple type, use value-of -->
        <xsl:value-of select="$value"/>
    <xsl:call-template name="repeat">
      <xsl:with-param name="n" select="$n - 1"/>
      <xsl:with-param name="value" select="$value"/>

 XSL-List info and archive:


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 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.