XT and Text Nodes

Subject: XT and Text Nodes
From: "Bloebaum, Amy M." <Amy.M.Bloebaum@xxxxxxxxxxxxxxx>
Date: Fri, 29 Jan 1999 09:29:41 -0500
I am attempting to eliminate all occurrences of the sequence <p><FS/></p>
from the XML document below.    

<?xml version="1.0" standalone="yes"?>
<doc>
<name><p><FS/>Foo</p></name>
<info><p><FS/></p><p>This is<FS/> a test.</p></info>
</doc>

If the <p> element contains any text, I want to preserve the element in the
result tree. 
>From the XSL spec, I would expect 'Foo' to be a text node in the XML
document tree and a child of element 'p'.
However, given the following style sheet, XT drops all three paragraph
elements from the result tree.   
Is this a problem with XT or did I miss something in the tree construction
process description?   Is there a better way to do this?

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";
		indent-result="yes">

<xsl:template match="doc">
  <HTML>
  <xsl:apply-templates/>
  </HTML>
</xsl:template>

<xsl:template match="FS">
  <xsl:text>&amp;nbsp;</xsl:text>
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="*/p">
  <xsl:choose>
    <!-- Match when Forced Space FS is only child of paragraph element -->
    <xsl:when test="./FS[first-of-any() and last-of-any()]">
    </xsl:when>
    <xsl:otherwise>
      <P>
      <xsl:apply-templates/>
      </P>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

</xsl:stylesheet>



Amy Bloebaum
Consulting Software Engineer
LEXIS-NEXIS
+1 937 865 6800


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread