xsl特定节点的调用模板

时间:2015-10-14 17:31:13

标签: xml xslt xpath

我有以下xsls:

<xsl:template name="subsection-command"> <xsl:if test="@variant and /isip/@requestToChangeFlag"> <xsl:call-template name="request-to-change" /> </xsl:if> </xsl:template>

<!-- Link for request to change --> <xsl:template name="request-to-change"> <xsl:variable name="checked"> <xsl:if test="@marked"> <xsl:text>checked="checked"</xsl:text> </xsl:if> </xsl:variable> <xsl:if test="@variant and //@requestToChangeFlag and not(@state) and not(@lockowner) and //@checkout='true' and not(self::component-procref) and not(//@documenttype='WiringVariant' and name(parent::node())='descop')"> <xsl:choose> <xsl:when test="@marked"> <input type="checkbox" checked="checked" name="requestToChange_nodeUID_{@uid}__prodSpecUid_{//@uid}__routeToRef_{@REF}"/> </xsl:when> <xsl:otherwise> <input type="checkbox" name="requestToChange_nodeUID_{@uid}__prodSpecUid_{//@uid}__routeToRef_{@REF}"/> </xsl:otherwise> </xsl:choose> <a href="{$servlet}?action=route&amp;prodSpecUid={//@uid}&amp;routeToRef={@REF}">Request to change</a> <xsl:text> </xsl:text> </xsl:if> </xsl:template>

我想打电话给#34;请求更改&#34;模板仅适用于 处理时<consolidated-training>节点。

我尝试了一些xsl匹配的方法,但是没有用。

我是新手在xsl主题。

我怎样才能做到这一点?

下面是输入xml。

<?xml version="1.0" encoding="utf-8"?> <isip MAINTAIN_WIRING_CODES="true" OpenStatus="open" REF="G1001364" author_mdx_objects="true" checkout="true" countrycode="DEU" edit_acp_codes="true" forcetranslate="true" langcode="de" maintain_cpsc_codes="true" maintain_index_items="true" maintain_labor_times="true" manufacturer="" model-name="" model-year="2020" quarter="0" uid="G1001364" userid="rtesh" variantid="2117"> <system OpenStatus="open" REF="G1001365" moidref="G27" order="sysno" sysno="1" title="Allgemeine Informationen" titleref="T6367" uid="G1001365"> <group OpenStatus="open" REF="G1001366" grpno="00" moidref="G28" order="grpno" title="Service-Informationen" titleref="T5" uid="G1001366"> <section OpenStatus="openable" REF="G1001367" moidref="G29" order="sectno" qualref="+Q106077[AAA]" sectno="00" suffix="A" title="Allgemeine Informationen" titleref="T6367" uid="G1001367"> <qualifier OpenStatus="closed" title="AAAFahrzeuge ausgestattet mit Air Conditioning"> <dtcprefix OpenStatus="closed" id="Q106077" title="AAA"/> </qualifier> </section> <section OpenStatus="openable" REF="G1001384" moidref="G29" order="sectno" qualref="+Q106068" sectno="00" suffix="B" title="Allgemeine Informationen" titleref="T6367" uid="G1001384"> <qualifier OpenStatus="closed" title="GB"> <territory-mfc OpenStatus="closed" id="Q106068" title="GB"> <mfc OpenStatus="closed" code="waegb" type="C" vl="vla1"/> <mfc OpenStatus="closed" code="waegb" type="T" vl="vltg"/> </territory-mfc> </qualifier> </section> <section OpenStatus="open" REF="G1006070" moidref="G29" order="sectno" sectno="00" suffix="C" title="Allgemeine Informationen" titleref="T6367" uid="G1006070"> <vscs OpenStatus="openable" REF="G1006071" moidref="G957692" uid="G1006071"/> <e-product-intro OpenStatus="openable" REF="G1006073" moidref="G983989" uid="G1006073"/> <consolidated-training OpenStatus="openable" REF="G1006075" moidref="G1006065" uid="G1006075"/> <descop OpenStatus="openable" REF="G1006077" moidref="G30" uid="G1006077"/> </section> <section OpenStatus="openable" REF="G1001387" moidref="G957735" order="sectno" qualref="+Q105582+Q105548" sectno="06" title="Vehicle Communications" titleref="T13995" uid="G1001387"> <qualifier OpenStatus="closed" title="130, Tiertransport"> <bodystyle OpenStatus="closed" id="Q105582" title="130"/> <conversiontype OpenStatus="closed" id="Q105548" title="Tiertransport"/> </qualifier> </section> </group> </system> <system OpenStatus="openable" REF="G1001390" moidref="G58" order="sysno" sysno="2" title="Fahrwerk" titleref="T8826" uid="G1001390"/> <system OpenStatus="openable" REF="G1001426" moidref="G841" order="sysno" sysno="3" title="Antriebsstrang" titleref="T5022" uid="G1001426"/> <system OpenStatus="openable" REF="G1001431" moidref="G2251" order="sysno" sysno="4" title="Elektrische Systeme" titleref="T5023" uid="G1001431"/> <system OpenStatus="openable" REF="G1002210" moidref="G3039" order="sysno" sysno="5" title="Karosserie und Lackierung" titleref="T5024" uid="G1002210"/> </isip>

0 个答案:

没有答案