parameter concatinating

Subject: parameter concatinating
From: "Richard Lander" <rlander@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 7 Aug 1999 14:51:45 -0400
 Hello,

I am having trouble using parameters, using the July 09 draft. I'd like to use
parameters to pass patterns to named templates, then add to those patterns in
particular situations. For example, I've defined the path parameter for this
purpose. In the following XSLT fragment , I'm trying to add '/@id' to the
pattern in the path parameter.

    <xsl:when test="$path/@id">

I've also tried:

    <xsl:when test="{$path}/@id">
and
    <xsl:when test="concat($path,'/@id')">

I am slowly coming to the conclusion that it is not possible to do what I want.
I guess the problem is that test does not allow attribute value templates ({ }).

The full template, which doesn't work, follows:

<xsl:template name="idcatcher_path">
  <xsl:param name="catch"/>
  <xsl:param name="path"/>
  <xsl:choose>
    <xsl:when test="$path/@id">
      <xsl:attribute name="{$catch}"><xsl:value-of
select="$path/@id"/></xsl:attribute>
    </xsl:when>
    <xsl:otherwise>
      <xsl:attribute name="{$catch}"><xsl:value-of
select="generate-id($path)"/></xsl:attribute>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

The xsl:call-template follows:

        <xsl:call-template name="idcatcher_path">
          <xsl:with-param name="catch">url</xsl:with-param>
          <xsl:with-param name="path">child::SECTION[1]</xsl:with-param>
        </xsl:call-template>


Thanks,

Richard.

Richard Lander
relander at uwaterloo.ca
http://pdbeam.uwaterloo.ca/~rlander/

Professional XML Authoring
http://www.on-line-learning.com/



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


Current Thread