我想打开/关闭的标签来变换处理的指令,像这样:转换_font处理指令CSS与XSL
<para><?Pub _font Weight="bold"?>Date Re-inspected<?Pub /_font?></para>
到
<div class="x-para-9-5"><span style="font-weight: bold">Date Re-inspected</span></div>
我试图执行Processing instructions transform但是第二副本的第一个PI的直接兄弟文本节点没有被删除(作为新手,我不明白为什么这段代码会删除它):
我不想要的结果T:
<div class="x-para-9-5"><span style="font-weight:bold;">Date Re-inspected</span>Date Re-inspected</div>
这是我的代码,从上面提到的其它问题稍微修改:
<xsl:template match="processing-instruction('Pub')">
<xsl:choose>
<xsl:when test="starts-with(., '_font')">
<xsl:choose>
<xsl:when test="contains(.,'bold')">
<span style="font-weight:bold;">
<xsl:apply-templates select="following-sibling::node()[1][self::text()]"/>
</span>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="starts-with(., '/_font')
| text()[preceding-sibling::node()[1][self::processing-instruction('_font')]]">
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:template>
理解任何建议,这是我的第一周XSL。
此外,我不知道什么字符“|”手段。我认为这意味着“或”。 – Caroline