XINCLUDE and XSLT

Here should go questions about transforming XML with XSLT and FOP.
jorabin
Posts: 1
Joined: Tue Oct 23, 2007 8:33 pm

XINCLUDE and XSLT

Post 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
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post 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
Post Reply