[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XT and Text Nodes
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>&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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|