[xslt] xsltproc xalan:write problem



Hi,

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>

and heres my input :-

<?xml version="1.0"?>
<book>
    <title>XSLT</title>
    <chapter>
        <title>1</title>
        <para>1</para>
    </chapter>
    <chapter>
        <title>2</title>
        <para>2</para>
    </chapter>
</book>

and heres what xsltproc is giving me :-

C:\Users\aaron\Tests\xslt>xsltproc document-write.xsl test.xml
runtime error: file document-write.xsl line 12 element write
xsltApplySequenceConstructor: failed to find extension write
runtime error: file document-write.xsl line 12 element write
xsltApplySequenceConstructor: failed to find extension write
no result for test.xml

Would appreciate it if anyone has got this feature working or has any idea why its not working please.

Many thanks in advance,

Aaron

--
Aaron Gray

Independent Open Source Software Engineer, Computer Language Researcher, Information Theorist, and amateur computer scientist.


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