Including a plain text file with XSLT 1.0
Asked Answered
E

1

4

How can I include the content of a plain text file in a result document from within an XSLT 1.0 stylesheet? I.e., just like document(), but without parsing it:

<xsl:value-of select="magic-method-to-include-plaintext(@xlink_href)" />

I am almost sure, that this doesn't work without extension, because:

  1. there is a special XPath function defined for this in XSLT/XPath 2.0:

    <xsl:value-of select="unparsed-text(@xlink:href, 'UTF-8')"/>
    
  2. the XSLT FAQ only lists a Java extension to achieve this via EXSLT

However, perhaps I missed something?

Empedocles answered 26/4, 2010 at 14:4 Comment(0)
S
4

However, perhaps I missed something?

No, XSLT 1.0 cannot access the content of a non-xml text file without using an extension function.

One way around this is to pass the string as a global parameter to the transformation.

Speedboat answered 26/4, 2010 at 16:4 Comment(1)
I am trying to access an xml file. But only use one node in the xml file instead of including the whole file itself. So how do i parse/traverse the file in xsl and only display that one node?Sorce

© 2022 - 2024 — McMap. All rights reserved.