Re: [xslt] xsltproc xalan:write problem



Hi Aaron,

Am Tue, 27 Feb 2018 23:59:26 +0000
schrieb Aaron Gray <aaronngray lists gmail com>:
 
I am trying to get xalan:write to work with libxslt's xsltproc. I have
looked at the source code and found code pertaining to its
implemetation but cannot get it to work from input. Heres my code :-

<?xml version="1.0"?>
<xsl:stylesheet
    version="1.1"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:xalan="http://xml.apache.org/xalan/redirect";
    extension-element-prefixes="xalan"
 
    <xsl:output method="html"/>

    <xsl:template match="/">
        <xsl:for-each select="/book/chapter">
            <xalan:write select="concat('chapter', position(),
'.html')"> <html>
                    <head>
                        <title><xsl:value-of select="title"/></title>
                    </head>
                    <body>
                        <h1><xsl:value-of select="title"/></h1>
                        <xsl:apply-templates select="para"/>
                    </body>
                </html>
            </xalan:write>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>

Nicolas gave you already an answer.

It looks a bit strange to me to use a Xalan extension element in
libxslt/xsltproc. Well, if it works, good for you. ;)

I would like to point you to another alternative: the exsl:document[1]
extension element. It does the same and is also supported by libxslt.


-----
[1] http://exslt.org/exsl/elements/document/index.html

-- 
Gruß/Regards,
    Thomas Schraitle


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