Question

I am using Apache FOP for PDF generation.I want to use unparsed-text() function to read non-xml document in XSL file.

After writing that function i got this error. This is my XSL file.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"
     xmlns:f="Functions">

     <xsl:variable name="properties" select="unparsed-text('file.properties')" as="xs:string"/>
        <xsl:function name="f:getProperty" as="xs:string?">
             <xsl:param name="key" as="xs:string"/>
              <xsl:variable name="lines" as="xs:string*" select="
             for $x in 
               for $i in tokenize($properties, '\n')[matches(., '^[^!#]')] return
              tokenize($i, '=')
             return translate(normalize-space($x), '\', '')"/>
         <xsl:sequence select="$lines[index-of($lines, $key)+1]"/>
  </xsl:function>

    <xsl:template match=" EmployeeData">
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
            <fo:layout-master-set>
                <fo:simple-page-master master-name="simple"
                    page-height="20cm" page-width="10.5cm" margin-left="0.2cm"
                    margin-right="0.2cm">
                    <fo:region-body margin-top="0.5cm" />
                </fo:simple-page-master>
            </fo:layout-master-set>
            <fo:page-sequence master-reference="simple">

                <xsl:variable name="lang" select="language" />

                <fo:flow flow-name="xsl-region-body">

                  From Properties File  <xsl:value-of     select="f:getProperty('language')"/>


                </fo:flow>
            </fo:page-sequence>
        </fo:root>
    </xsl:template>
</xsl:stylesheet>

How can i remove this error? Or give me any alternative for that if possible. Thank you.

Était-ce utile?

La solution

The error suggests you are using an XSLT 1.0 processor to run the XSLT. unparsed-text is only supported by XSLT 2.0 processors like Saxon 9.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top