cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <tcu...@dff.st>
Subject child node
Date Mon, 24 Jul 2000 07:56:24 GMT
Lets say I have a template that is matched
against "text". Now I want to check if there
is a child node named "defaulttext". If there
is one I want to apply it's template.

I was thinking of something like the following but
I guess my XPath syntax for the test is not correct.

XML:
<text>
  <sometag>bla</sometag>
  <defaulttext>blub</defaulttext>
</text>

XSL:
<xsl:template match="text">
  <xsl:choose>
    <xsl:when test="@url">
      ...
    </xsl:when>
    <xsl:when test="child::defaulttext">
      <xsl:apply-templates select="child::defaulttext"/>
    </xsl:when>
  </xsl:choose>
</xsl:template>

<xsl:template match="defaulttext">
 <h1><xsl:apply-templates/></h1>
</xsl:template>
--
Torsten

Mime
View raw message