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

Re: XML serializer in XSLT 2.0, using FXSL, to text an

Subject: Re: XML serializer in XSLT 2.0, using FXSL, to text and HTML
From: Florent Georges <darkman_spam@xxxxxxxx>
Date: Thu, 21 Dec 2006 13:41:48 +0100 (CET)
Re:  XML serializer in XSLT 2.0
Dimitre Novatchev wrote:

  Hi Dimitre

> Florent Geores:

>>     I just wrote a few stylesheets to serialize sequences.

>>     If you are interested, you can find it, as well as a
>>   few words, here:

>>       http://www.fgeorges.org/xslt/serial/

> Could you describe the general ideas and architecture,
> please?

  Of course.  There are also a few infos on the page above.
The main idea is simple.  The serialization function takes a
sequence as input, does a sequence normalization as in '2 in
"XSLT 2.0 and XQuery 1.0 Serialization", and use template
rules to walk this tree.  A usual XSLT serializer.

  But the template rules don't serialize the nodes
themselves.  They send instead messages to a receiver object
that does the actual job.  The receiver is a structure of
several function objects: a function serializing start tags,
another for processing instructions, etcetera.

  So when you use the main serialization function, you can
choose the receiver to use, as well as several options.  You
can even customize the sequence normalizer.  As for now,
there is only one option: indentation (do make indentation?,
and how many spaces to use?).

  There are two receiver, one that creates a text node and
another that creates HTML nodes.  They only have to deal
with "how to serialize these and these events".  They don't
worry about walking through the input sequence nor about
several options at a higher level.

  src/serial.xsl is the main stylesheet, src/serial-text.xsl
and src/serial-html.xsl are the two receiver for resp. text
and HTML.  They can be used as example of creating a new

  BTW, the interest of the HTML receiver is that it wrap
some of the text into 'span' elements, with appropriate
@class (there is one class for element local name, for
element name prefix, for attribute values, etcetera).  So it
is easy to insert XML fragment into HTML with syntactic

  One receiver could be created to output HTML that allow
the user to collapse/expand the XML elements (as in the XML
view in XML IDEs and browsers).

  Filtering serializers can also easily be built, using the
decorator pattern.  For example if you want to filter out
elements by name, you create a function that handles the
start and end tag events, and test the name of the element;
if the element needs to be serialized, the function call the
original function (else it does nothing).

  Those are unordered thoughts.  I hope I answered your
question.  I still have to wrote a more comprehensive and
accurate documentation.




Dicouvrez une nouvelle fagon d'obtenir des riponses ` toutes vos questions ! 
Profitez des connaissances, des opinions et des expiriences des internautes sur Yahoo! Questions/Riponses 

Current Thread


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.
First Name
Last Name
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.