运行xsl时出现静态错误

时间:2012-11-29 09:34:56

标签: xslt

为了尝试从java传递Xpath,我使用saxon:evaluate()方法修改了我的xsl文件。但我得到的错误,

Static error in XPath expression supplied to saxon:evaluate: XPath syntax error at char 0 in {}:
        Unexpected token "<eof>" in path expression

XSLT:

    <?xml version="1.0" encoding="utf-8"?>
   <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml">


<xsl:output method="text" encoding="utf-8"/>

    <xsl:param name="xPath1"/>
    <xsl:param name="xPath2"/>

    <xsl:template match="/">

        <xsl:for-each select="saxon:evaluate($xPath1)">
            <xsl:value-of select="saxon:evaluate($xPath2)"/>        
        </xsl:for-each>

    </xsl:template>
</xsl:stylesheet>

xPath1=//w:p[w:pPr/w:pStyle[matches(@w:val,'tablecaption|figcaption')] and w:r[w:rPr/w:rStyle[matches(@w:val,'citation')]]]
xPath2=w:r[w:rPr/w:rStyle[matches(@w:val,'citation')]]

0 个答案:

没有答案