Hi Alice,
Alice Fan wrote:
this is what i'm doing to copy all nodes except for a specific element
name. how do i specify a specific attribute inthe if statement?
Well, you can find an example of how to copy all nodes in the XSLT spec
(in the identity transform described at
http://www.w3.org/TR/xslt#copying) and you can build on this to match
and trap a specific attribute (or element)
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- copy all nodes... -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- ...except this one -->
<xsl:template match="@id" />
</xsl:stylesheet>
This is somewhat similar to what you were trying to do, but matching
templates by pattern is more fun (and more in the spirit of XSLT) than
coding xsl:if statements.
But if you do want to use explicit logic rather than pattern matching,
you can use:
<xsl:if test="not(self::someelement)">...</xsl:if>
if you know the element name at build time, or use:
<xsl:if test="not(localname() = $targetNodeName)">...</xsl:if>
if the element name will be set at run time.
Francis.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list