[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] MS XML 3.0 and 4.0 nonconformance
Hello, friends. If we use MS XML 3.0 or 4.0 and transform this: <x> <y/> </x> via this: <t:transform version="1.0" xmlns:t="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="ms"> <t:template match="*" mode="text-check"> <t:variable name="n" select="count(.//text())"/> <t:choose> <t:when test="$n=0">no text nodes</t:when> <t:otherwise><t:value-of select="$n"/> text nodes</t:otherwise> </t:choose> </t:template> <t:template match="/*"> <result> <original> <t:copy-of select="."/> </original> <original-check> <t:apply-templates select="." mode="text-check"/> </original-check> <t:variable name="rtf"> <t:copy-of select="."/> </t:variable> <rtf-nodeset> <t:copy-of select="ms:node-set($rtf)/*"/> </rtf-nodeset> <rtf-nodeset-check> <t:apply-templates select="ms:node-set($rtf)/*" mode="text-check"/> </rtf-nodeset-check> </result> </t:template> </t:transform> then we obtain: <result><original><x> <y /> </x></original><original-check>no text nodes</original-check><rtf-nodeset><x> <y /> </x></rtf-nodeset><rtf-nodeset-check>2 text nodes</rtf-nodeset-check></result> or (formatted): <result> <original> <x> <y/> </x> </original> <original-check>no text nodes</original-check> <rtf-nodeset> <x> <y/> </x> </rtf-nodeset> <rtf-nodeset-check>2 text nodes</rtf-nodeset-check> </result> As we see, text nodes appear after converting a node list into an RTF and then back into a node list. Furthermore, when copied, a node list preserves its line breaks but looses spaces. Actually, according to W3C, there should be "2 text nodes" in the "original-check" as well (!), since no strip-space elements are set: "Initially, the set of whitespace-preserving element names contains all element names." By the way, say, Saxon is fully conformant in this sense: it shows 2 text nodes in both cases and copies them properly. -- Alexander E. Gutman 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
|