You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by tc...@dff.st on 2000/07/24 09:56:24 UTC

child node

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