I think you want to test whether there are any non-white descendant text
nodes that are not descendants of a child TLStyle.
In 2.0 that's
test="(.//text() except TLStyle//text())[normalize-space()]"
or in 1.0
test="(text() | *[not(self::TLStyle)]//text())[normalize-space()]"
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Emily(_dot_)Garrett(_at_)thomson(_dot_)com
[mailto:Emily(_dot_)Garrett(_at_)thomson(_dot_)com]
Sent: 07 September 2006 20:36
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Ignoring a child element
I'm trying to weed out a <para> element that does not have
any content.
However, it does have a TLStyle element which would style the
content if it existed. The XML table entry looks like this:
<entry colname="1" morerows="0"
align="left" valign="top">
<para>
<TLStyle>BodyText</TLStyle>
</para>
</entry>
I tried using normalize-space(.), but since the TLStyle
element is in there, it tests true. normalize-space(.) = BodyText
<xsl:choose>
<xsl:when test="normalize-space(.)">
<xsl:apply-templates select="current()"/>
</xsl:when>
The following code also tests true, but I'm not sure why. I
want it to ignore what's in TLStyle and tell me if there is
any other content inside of <entry>.
<xsl:variable
name="withoutTLStyle" select="node()[not(self::TLStyle)]"/>
<xsl:choose>
<xsl:when test="normalize-space($withoutTLStyle)">
<xsl:apply-templates select="current()"/>
</xsl:when>
<xsl:otherwise>
<!--do
something else because it's empty-->
</xsl:otherwise>
</xsl:choose>
normalize-space($withoutTLStyle) is also = BodyText.
Any thoughts on how to conquer this?
Emily Garrett
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--