Am Mittwoch, den 23.08.2006, 19:55 +0200 schrieb Buchcik, Kasimier:
> Hi,
>
> Works for me with the CVS HEAD and the following scenario:
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> <xsl:template match="/">
> <xsl:param name="foo">
> <xsl:variable name="bar">
> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
> href="xinclude-inc.txt" parse="text"/>
> </xsl:variable>
> <xsl:message>XIncluded text: "<xsl:value-of
> select="$bar"/>"</xsl:message>
> <xsl:variable name="norm-bar" select="normalize-space($bar)"/>
> <xsl:message>Normalized text: "<xsl:value-of
> select="$norm-bar"/>"</xsl:message>
> <xsl:choose>
> <xsl:when test="$norm-bar = 'hello'">success</xsl:when>
> <xsl:otherwise>failure</xsl:otherwise>
> </xsl:choose>
> </xsl:param>
> <xsl:value-of select="$foo"/>
> </xsl:template>
>
> </xsl:stylesheet>
>
> The file "xinclude-inc.txt" contains only the text "hello".
>
> Result:
>
> XIncluded text: "hello"
> Normalized text: "hello"
> <?xml version="1.0"?>
> success
Something similar also already worked for me (with Daniel Veillard's
patch, mentioned in this thread). The "problem": This is not, how
docbook-xsl inbounds parameters (they are in a separate XSL file
param.xsl, the is included by docbook.xsl using xsl:include). I attached
sample files to test the issue (arcticle.001.xml was just taken from the
testdocs SVN directory of docbook-xsl). With these files you should be
able to reproduce the problem. The results are:
$ xsltproc --xinclude xinclude.xsl article.001.xml
=> Read content of xinclude-inc.txt: "failure"
$ java -cp "/usr/share/java/saxon.jar:/usr/share/java/xercesImpl.jar" \
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl \
-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl \
-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration \
com.icl.saxon.StyleSheet article.001.xml xinclude.xsl
=> Read content of xinclude-inc.txt: "success"
$ java -cp "/usr/share/java/xalan2.jar:/usr/share/java/xercesImpl.jar" \
-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration \
org.apache.xalan.xslt.Process -in article.001.xml -xsl xinclude.xsl
=> Read content of xinclude-inc.txt: "success"
> Your file seems to exist, since if it is not found, then
> we'll get the following error message:
>
> xinclude-1.xsl:8: element include: XInclude error :
> could not load xinclude-inc.txt, and no fallback was found
It exists.
> Very vague question: does your referenced file really contain
> the values you compare against? (Note that normalize-space()
> does not change the case of letters)
Yes, it does :)
Regards, Daniel
Attachment:
article.001.xml
Description: application/docbook
hello
Attachment:
xinclude-param.xsl
Description: application/xslt
Attachment:
xinclude.xsl
Description: application/xslt