[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Supressing entity expansion during XSLT transform


Subject: Re: [xsl] Supressing entity expansion during XSLT transform
From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>
Date: Sat, 12 Jan 2008 09:06:09 +0000

>>>>> "Michael" == Michael Kay <mike@xxxxxxxxxxxx> writes:

    >> Now if everyone decided to implement the saxon prefix +
    >> namespace for common extensions previously non-portable
    >> stylesheets would become portable...

    Michael> The previous history is that once an extension is
    Michael> sufficiently recognized that people ask for it in
    Michael> additional processors, an EXSLT function gets defined and
    Michael> people implement that. Is anyone in a position to do
    Michael> this?

Getting anything into EXSLT takes forever and a day, so I would say
the answer is no.

Environment variables for system-property STILL don't appear on their
website, although the spec was finalized long ago. But agreeing the
spec. was only done because it could apply to XSLT 1.0 as well as 2.0.

If it's 2.0 only, they won't touch it.


Anyway, for Ssaxon:parse, here's my emulation:

<?xml version="1.0" encoding="UTF-8"?>

<!-- Emulation of some saxon extension functions in pure XSLT 2.0 -->

<xsl:stylesheet  
    use-when="system-property('xsl:vendor-url') ne 'http://www.saxonica.com/'"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:saxon="http://saxon.sf.net/"
    exclude-result-prefixes="xs saxon"
    version="2.0" 
>

<!-- 
     saxon:parse
     The same node will be returned eace time if the argument is identical
     (but if it differs even by as much as an ignorable white space,
     a different node will be returned, as the invocation URI will be different)
     unless document stabalization has been suppressed)
-->

<xsl:function name="saxon:parse" as="document-node()">
 <xsl:param name="xml" as="xs:string"/>
 <xsl:sequence select="doc(concat('data:data:application/xml;charset=UTF-8,', encode-for-uri($xml)))"/>
</xsl:function>


</xsl:stylesheet>

For saxon:serialize, I first need to understand how to invoke
Florent's serializer.

Incidentally, Michael, I am puzzled by one aspect of the design of
saxon:serialize - namely the passing of an xsl:output element.

If I was writing a built-in extension function, I would take advantage
of access to the processor internals, and pass the value of the
xsl:output name attribute. 
-- 
Colin Adams
Preston Lancashire


Current Thread
Keywords