[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Unanticipated Results from text()

Subject: Re: Unanticipated Results from text()
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Fri, 23 Feb 2007 23:41:52 +0530
Re:  Unanticipated Results from text()
While coding the XSLT stylesheet for IE, you cannot write logic that
depends on whitespace text nodes. Because, as Mike explained, with IE,
whitespace text nodes are stripped from source XML before the XML tree
is handed to the XSLT engine. This behaviour is observed only when we
use XSLT in IE using xml-stylesheet PI.

On 2/23/07, Signature House <systems@xxxxxxxxxxxxxxxxxx> wrote:
Hi

I'm working on a project involving an XML import into the FileMaker DB package. I'm using Internet Explorer to do quickie proofing
on my stylesheets before using them in FM since FM is a bit of a kludge.

I got one bit working the way I wanted in IE, but got a different result when I moved it into FM.

Using the IE STYLESHEET and XML INPUT 1 below, I got IE RESULTS FROM BOTH INPUTS vs FM RESULTS FROM INPUT 1. The
"normalize-space(text())" picked up the B2 text in IE but didn't in FM.

I ran about a dozen different versions of the XML input, removing 1 or more line breaks from different places. IE always picked up
the B2 text; sometimes FM did, sometimes it didn't (see at FM RESULTS FROM INPUT 2 for one where FM did work).

Empirically, if <BBB><CCC> were on the same line, IE & FM returned the same results; if <BBB><CCC> were on separate lines, the
results were different.

I'm working on a PC running XP SP2, IE 6 SP2 and FM 8.03. FM says they're using an Xerces-based XML parser and an Xalan-based XSLT
processor (Xerces-C 1.6.0, Xalan-C 1.3.0). My stylesheets use the same XSLT, but for FM I have to remove the HTML and add a bunch of
required metadata. It's longish so I didn't include it but I can if someone needs to see it. The line breaks are the standard
Windows hex 0D 0A pair.

Does anybody have any suggestions as to what is going on?
- Is the placement of the B2 text valid XML?
- Is this a difference between IE & Xalan?
- What results should I expect - B2 or not B2? (Gee, I should have used 2B as the sample!)

Thanks in advance

Mike McBee
Signature House
systems@xxxxxxxxxxxxxxxxxx
www.signaturehouse.net
304-842-3386


IE STYLESHEET <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="List Nodes - HTML.xsl"?> <xsl:template match="/"> <table> <tr><td>Name</td><td>Text</td><td>Period</td></tr> <xsl:for-each select="//*"> <tr> <td><xsl:value-of select="name(.)"/></td> <td><xsl:value-of select="normalize-space(text())"/></td> <td><xsl:value-of select="normalize-space(.)"/></td> </tr> </xsl:for-each> </table> </xsl:template>


XML INPUT 1 <?xml version="1.0"?> <?xml-stylesheet?> <AAA> <BBB> <CCC> C1 </CCC> B2 </BBB> </AAA>


XML INPUT 2 <?xml version="1.0"?> <?xml-stylesheet?> <AAA><BBB><CCC>C1</CCC>B2</BBB></AAA>


IE RESULTS FROM BOTH INPUTS Name Text Period AAA C1 B2 BBB B2 C1 B2 CCC C1 C1


FM RESULTS FROM INPUT 1 Name Text Period AAA C1 B2 BBB C1 B2 CCC C1 C1


FM RESULTS FROM INPUT 2 Name Text Period AAA C1 B2 BBB B2 C1 B2 CCC C1 C1


--
Regards,
Mukul Gandhi

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.