Re: [xsl] Determining if an optional attribute is present

Subject: Re: [xsl] Determining if an optional attribute is present
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 17 Oct 2006 17:40:03 +0100
you are making it too hard:-)


test="@revision" is the test you arre looking for, but you don't need
the test at all.


replace

<node>
<xsl:attribute name="revision">
  <xsl:if test="not(string(@revision)) = false()">
    <xsl:value-of select="@revision"/>
  </xsl:if>
  <xsl:if test="not(string(@revision))">
    <xsl:text>0</xsl:text>
  </xsl:if>
</xsl:attribute>
</node>

by

<node revision="0">
 <xsl:copy-of select="@revision"/>
</node>

Current Thread