开发者

How to get the elements <and> and <or> in XPath with Jre default Processor (JAXPSAXProcessor)

I am working with some xml files which contain and/or tags. I want to transform them to html. In my XSL I am using two templates

<xsl:template match="and">
    (
    <xsl:apply-templates select="./*[1]" />
    <xsl:text> </xsl:text>
    <xsl:value-of select="name(.)" />
    <xsl:text> </xsl:text>
    <xsl:apply-templates select="./*[2]" />
    )
</xsl:template>
<xsl:template match="or">
    (
    <xsl:apply-templates select="./*[1]" />
    <xsl:text> </xsl:text>
    <xsl:value-of select="name(.)" />
    <xsl:text> </xsl:text>
    <xsl:apply-templates select="./*[2]" />
    )
</xsl:template>

It Works when i am using Xalan as a processor but when I am using开发者_JS百科 JAXPSAXProcessor I am getting errors: ERROR [main] JAXPSAXProcessorInvoker - Syntax error in 'or'. ERROR [main] JAXPSAXProcessorInvoker - Syntax error in 'and'.

I suppose that JaxPSaxProcessor translates and/or to the operators in Xpath. here you can see the list of operators I can not change the jaxb processor because it have been used in many places. Is there any other sugesstion to solve the problem?


If the XSLT processor is that buggy, you may try cheating it using a number of techniques, such as:

<xsl:template match="*[name()=concat('a', 'nd')">

or

<xsl:template match="*[name()=substring('land',2)">

Good luck.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜