SAX2 and XSLT processors

Arkin arkin at trendline.co.il
Wed May 19 17:53:25 BST 1999


I have been requested to implement this feature in an XML library more
than once, both by XSL users and for other related external documents
(XSP, DCP, whatever).

I think it could and should be done in a very generic manner, allowing
the application to specify one or more external documents using the same
PI mechanism and the parser would respond by placing them (or reporting
them) through the properties. By scope these references should be one
per document and always appear above the root element.

Feature:
  http://xml.org/sax/features/xsl-transform
  If true the parser sould attempt to apply XSL transformation and
return the results, if XSL is supported.

Property:
  http://xml.org/sax/property/xsl-stylesheet
  Read and write. If set before the parser is started, will introduce
the PI directive using the supplied system identifier into the document
name, if no such PI already exists. When read, will use either the one
supplied in the document or the one supplied in the property (whichever
comes last) and return a system identifier. EntityResolver can be used
to get the InputStream.

In addition, I think the following could be useful:

Property:
  http://xml.org/sax/property/document-base
  Read and write. Provide a URL for resolving all relative URLs
appearing in the document (stylesheet, external entities, etc). Could be
used to supply a fake base URL when the document is parsed from memory.
Could be used to return the base URL when the document is parsed from a
real URL, e.g. for the purpose of locating an external stylesheet.

Arkin


David Megginson wrote:
> 
> Oren Ben-Kiki writes:
> 
>  > One interesting way for doing it would be to build upon the SAX2
>  > extension mechanism, providing a standard SAX2 feature called
>  > http://xml.org/sax/features/xslt-transformation and a write only
>  > property it uses, called
>  > http://xml.org/sax/properties/xslt-stylesheet which takes an
>  > InputSource value.
> 
> I think that it's a great approach, but the feature and property
> probably don't belong in the core, for two reasons:
> 
> 1. XSL is not yet a recommendation; and
> 2. there are many other specs, such as RDF, XML Linking, and XML
>    Schemas, that could fairly claim equal treatment.
> 
> That said, there is no reason at all that someone couldn't define such
> a feature and property outside of the SAX2 core list and let the
> market decide.
> 
> All the best,
> 
> David
> 
> --
> David Megginson                 david at megginson.com
>            http://www.megginson.com/
> 
> xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
> Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
> To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
> (un)subscribe xml-dev
> To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
> subscribe xml-dev-digest
> List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list