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

MS XML 3.0 and 4.0 nonconformance

Subject: MS XML 3.0 and 4.0 nonconformance
From: gutman@xxxxxxxxxxxxxxxx
Date: Tue, 25 Feb 2003 14:53:02 +0600
ms xml 3.0
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


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.