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

Re: XSLT 1.0 serializer for XML

Subject: Re: XSLT 1.0 serializer for XML
From: Hermann Stamm-Wilbrandt <STAMMW@xxxxxxxxxx>
Date: Thu, 19 Aug 2010 18:14:36 +0200
Re:  XSLT 1.0 serializer for XML
> It has been done in XSLT 1.0 too:
> http://lenzconsulting.com/xml-to-string/xml-to-string.xsl

Thanks for the pointer.
I modified serialize-demo.xml to use xml-to-string.xsl and it
produced identical output in the browser.


> The XSLT/XPath data model does not know any CDATA sections respectively
> does not distinguish between "normal" text nodes and CDATA section
> nodes, like the W3C DOM does. So XSLT operates on a tree model where
> there are only text nodes.

So what does this section of xml-to-string.xsl do then?
  <xsl:template name="escape-markup-characters">
    <xsl:param name="text"/>
...
    <xsl:call-template name="replace-string">
      <xsl:with-param name="text" select="$ltEscaped"/>
      <xsl:with-param name="replace" select="']]>'"/>
      <xsl:with-param name="with" select="']]&amp;gt;'"/>
    </xsl:call-template>
  </xsl:template>

It cannot see the "]]>", correct?


Another question,   <xsl:template name="isDeclaredAbove">
does a recursive search to determine whether a namespace is declared
above the current element.

This seems to work in serialize.xsl and does the same job:
     <xsl:if test="not(.=../../namespace::*) and name()!='xml'">

Is it correct?


Mit besten Gruessen / Best wishes,

Hermann Stamm-Wilbrandt
Developer, XML Compiler, L3
WebSphere DataPower SOA Appliances
----------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294



From:       Martin Honnen <Martin.Honnen@xxxxxx>
To:         xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Date:       08/19/2010 05:40 PM
Subject:    Re:  XSLT 1.0 serializer for XML



Hermann Stamm-Wilbrandt wrote:

> in another thread Florent posted [1] a link to a XML serializer written
> in pure XSLT [2].
> That serializer is written in XSLT 2.0 and cannot be used in browsers;
> they do support XSLT 1.0 only.

It has been done in XSLT 1.0 too:
http://lenzconsulting.com/xml-to-string/xml-to-string.xsl

> With Michael's help I got the differentiation of the 6 XML node types

> Question 3:
> Is it correct, that a stylesheet cannot have access to the CDATA
sections?
> (I think the parser removes them)

The XSLT/XPath data model does not know any CDATA sections respectively
does not distinguish between "normal" text nodes and CDATA section
nodes, like the W3C DOM does. So XSLT operates on a tree model where
there are only text nodes.



--

             Martin Honnen
             http://msmvps.com/blogs/martin_honnen/

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.