Re: [xml-dev] XSLT with DOM or SAX ?

From
Robert Koberg <>
To
Michael Kay <>
Date
2005-03-28T19:36:13Z
ID
<>
Thread
Re: [xml-dev] XSLT with DOM or SAX ?
Michael Kay wrote:
>>You could stick it into the XSL stylesheet itself (using XInclude 
>>perhaps an entity). Then you can cache the Templates object.
> 
> 
> That might work with some processors. With Saxon, it won't. Saxon never
> pre-evaluates the document() function at compile time. There could be a
> run-time URIResolver that redirects the URI (even "") to somewhere else.

OK - I was guessing :)

If no resolver for "", wouldn't the the transformation work on an 
already parsed tree (cached in the Templates object??) for the 
particular processor? Does document('') load the XSL from the source again?

I wonder how other processors deal with it??

-Rob


> 
> Also, I think the originator wanted to transform the same source document
> using different stylesheets.
> 
> Michael Kay
> http://www.saxonica.com/
> 
>  
> 
>>Then when 
>>you transform, you could access the included XML with something like:
>>
>>Source XML:
>><whatever/>
>>
>>XSL:
>>
>><?xml version="1.0" encoding="UTF-8"?>
>><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
>>xmlns:my="my" version="1.0">
>>
>>   <my:something boo="foo"/>
>>
>>   <xsl:template match="/">
>>     <boo>
>>       <xsl:value-of
>>         select="document('')/xsl:stylesheet/my:something/@boo"/>
>>     </boo>
>>   </xsl:template>
>>
>></xsl:stylesheet>
>>
>>best,
>>-Rob
>>