This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Efficient Stylesheets for reordering


Jose,

> Am I completely wrong on my understanding of XSLT?

Almost ;) The big gap seems to be that you think that the XSLT
processor is working on a stream of information that comes into it
from the XML, and is writing out a stream of information concurrently.
This is inaccurate.

What actually happens is that the XSLT processor parses the XML
document and creates from it a tree representation of the document
(the Document Object Model or DOM).  It stores this DOM in memory and
operates over it to create another DOM (the result).  Then it
(usually) serialises this DOM into an output file.

One of the points about XSLT is that processors don't *have* to do all
the processing sequentially: there is nothing in the language that
prevents them from applying templates to s1 nodes, s2 nodes, s3 nodes
and so on, all concurrently, and then constructing the result from
that directly.

Some processors allow asynchronous and partial transformation.  You
could have a look at MSXSL (XSLProcessor) and Saxon (saxon:preview)
which may be helpful.

In your case, where you're just copying nodes across from one tree
into a different structure, you can use xsl:copy-of rather than
xsl:apply-templates:

<xsl:template match="doc1" >
  <xsl:copy-of select="s1[1]" />
  <xsl:copy-of select="s3" />
  <xsl:copy-of select="s4[1]" />
  <xsl:copy-of select="s2[1]" />
  <xsl:copy-of select="s5" />
</xsl:template>

I'm not sure whether the position predicates will make much
difference, but they certainly won't hurt unless you change your DTD.

I hope that helps somewhat,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]