Page 1 of 1

XINCLUDE and XSLT

Posted: Tue Oct 23, 2007 8:44 pm
by jorabin
I'd like to include a text file in my XSLT output, the precise file to be specified by an XSLT parameter, but can't use document() to do this as the file isn't XML.

I've considered using XInclue but can't figure out how to do this. Using a constuct like this:

<xi:include parse="text">
<xsl:attribute name="href">
<xsl:value-of select="$includeme"/>
</xsl:attribute>
</xi:include>

if I enable XInclude processing then the wrong thing happens (I get the XSLT file included as text). If I disable it then I end up with xi:include in my xhtml output - what's the best way then of actually making the include happen? If I run an identity transform, I need to change the configuration to enable include procesing? Then switch it off again before running the first transform again?

thanks in advance

Jo

Posted: Wed Oct 24, 2007 12:41 pm
by sorin_ristache
Hello,

You should use the XSLT 2.0 function unparsed-text($uriOfNonXMLFile), for example:

Code: Select all


<xsl:variable name="fileContent" select="unparsed-text($uriOfFile)"/>
Regards,
Sorin