[xslt] XInclude-processing in XSL stylesheets (was: Implementation of unparsed-text() (XSLT 2.0)?)



Am Mittwoch, den 16.08.2006, 16:27 +0200 schrieb Daniel Leidert: 
> Am Mittwoch, den 16.08.2006, 09:54 -0400 schrieb Daniel Veillard:
> 
> [XIncluding a text-file to a variable-content in XSLT]
> >   ah ! xinclude wasn't applied to the stylesheet itself only on documents.
> > Can you test the attached patch ?
> 
> Tested and it looks very good. The xi:include element is processed and I
> observe the expected/wanted result.
> 
> [..]
> <xsl:variable name="system.paper.size"><xi:include href="file:///etc/papersize" parse="text"/></xsl:variable>
> [..]
> <xsl:text>Size: </xsl:text>
> <xsl:value-of select="normalize-space($system.paper.size)"/>
> [..]
> 
> Result:
> 
> [..] Size: a4 [...]
> 
> Perfect. Many thanks!

Hmm. I now tried to incorporate the things into docbook-xsl and found,
that saxon/xerces and xalan/xerces work, but xsltproc still does not do,
what I want it to do. Maybe you could check this again (I guess, the
problem now is at a different place). What did I do: The docbook-xsl
stylesheets define parameters with default values. I now want to
determine a parameters default value from the content of /etc/papersize.
Therefor I used the following code:

> <xsl:param name="paper.type">
>   <xsl:variable name="debian.libpaper.paper.type">
>     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"; href="/etc/papersize" parse="text"/>
>   </xsl:variable>
>   <xsl:variable name="debian.system.paper.type" select="normalize-space($debian.libpaper.paper.type)"/>
>   <xsl:choose>
>     <xsl:when test="$debian.system.paper.type = 'a0'">A0</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'a1'">A1</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'a2'">A2</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'a3'">A3</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'a4'">A4</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'a5'">A5</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'a6'">A6</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'a7'">A7</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'a8'">A8</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'a9'">A9</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'a10'">A10</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'b0'">B0</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'b1'">B1</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'b2'">B2</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'b3'">B3</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'b4'">B4</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'b5'">B5</xsl:when>
>     <xsl:when test="$debian.system.paper.type = 'letter'">USletter</xsl:when>
>     <xsl:otherwise>USletter</xsl:otherwise>
>   </xsl:choose>
> </xsl:param>

/etc/papersize contains 
a4

So docbook-xsl should output, that it uses an A4 size for the paper
size. But I always get USletter, because $debian.libpaper.paper.type
seems to be empty. My fault or a limitation of xsltproc?

Regards, Daniel



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]