Xml 查看满足XPATH定义行为的下一个节点

Xml 查看满足XPATH定义行为的下一个节点,xml,xslt,xpath,xslt-2.0,restructuredtext,Xml,Xslt,Xpath,Xslt 2.0,Restructuredtext,我目前正在编写一个XSLT文档,以将JavadocXML输出(不可修改)转换为重新构造的文本。我遇到的一个问题是javadoc将具有类似这样的结构的XML <node1> <node2> <code/> </node2> <node3> <![CDATA[DataType]]> </node3> </node1> <node1>

我目前正在编写一个XSLT文档,以将JavadocXML输出(不可修改)转换为重新构造的文本。我遇到的一个问题是javadoc将具有类似这样的结构的XML

<node1>
   <node2>
       <code/>
   </node2>

   <node3>
      <![CDATA[DataType]]>
   </node3>
</node1>

<node1>
   <node3>
      <![CDATA[s need special formatting, but breaks in restructured text]]>
   </node3>
</node1>
``DataType``\s need special formatting, but breaks in restructured text
在重新构造的文本中,结束符``后面不能跟字母数字,或者无法正确呈现,因此,我需要能够看到下一个匹配
//node1/node3
的节点的第一个字符是否不是字母数字,如果是字母数字,则需要像这样对其进行分隔

<node1>
   <node2>
       <code/>
   </node2>

   <node3>
      <![CDATA[DataType]]>
   </node3>
</node1>

<node1>
   <node3>
      <![CDATA[s need special formatting, but breaks in restructured text]]>
   </node3>
</node1>
``DataType``\s need special formatting, but breaks in restructured text
但是如果是标点符号,下面的就可以了

``DataType``. need special formatting, but breaks in restructured text
XSLT2.0是否可以实现这一点

做“向后看”可能比尝试向前看更容易,例如

<xsl:template match="node1/node3" priority="1">
  <xsl:value-of select="." />
</xsl:template>

<xsl:template match="node1[node2/code]/node3" priority="2">
  <xsl:text>``</xsl:text>
  <xsl:next-match />
  <xsl:text>``</xsl:text>
</xsl:template>

<!-- special template for the block immediately following a node2/code block -->
<xsl:template match="node1[preceding-sibling::node1[1]/node2/code]/node3" priority="3">
  <xsl:if test="matches(., '^[A-Za-z0-9]')">\</xsl:if>
  <xsl:next-match />
</xsl:template>