Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Templates 使用某种选择器或变量将重复模板合并到单个模板中_Templates_Xslt - Fatal编程技术网

Templates 使用某种选择器或变量将重复模板合并到单个模板中

Templates 使用某种选择器或变量将重复模板合并到单个模板中,templates,xslt,Templates,Xslt,如何将四个几乎相同的模板转换为一个模板?我希望能够有一个变量或至少一个可以指定父节点组的位置 <!-- identity transform --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:

如何将四个几乎相同的模板转换为一个模板?我希望能够有一个变量或至少一个可以指定父节点组的位置

<!-- identity transform -->
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="ViewSuperbillProcedureScrubFullInsurance/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillScrubFullInsurance/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillProcedureScrub/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillScrub/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>


</xsl:stylesheet>
我试着做一些类似的事情

<xsl:template match="ViewSuperbillProcedureScrubFullInsurance|ViewSuperbillScrubFullInsurance|ViewSuperbillProcedureScrub|ViewSuperbillScrub/column/@width[not(../@AutoWidth)]">
<!-- identity transform -->
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="ViewSuperbillProcedureScrubFullInsurance/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillScrubFullInsurance/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillProcedureScrub/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillScrub/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>


</xsl:stylesheet>

<!-- identity transform -->
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="ViewSuperbillProcedureScrubFullInsurance/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillScrubFullInsurance/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillProcedureScrub/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillScrub/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>


</xsl:stylesheet>

<!-- identity transform -->
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="ViewSuperbillProcedureScrubFullInsurance/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillScrubFullInsurance/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillProcedureScrub/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillScrub/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>


</xsl:stylesheet>
ViewSuperbillProcedureScrubFullInsurance | ViewSuperbillScrubFullInsurance | ViewSuperbillProcedureScrub | ViewSuperbillScrub
但什么都不管用

<!-- identity transform -->
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="ViewSuperbillProcedureScrubFullInsurance/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillScrubFullInsurance/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillProcedureScrub/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillScrub/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>


</xsl:stylesheet>
以下是完整的xsl:

<!-- identity transform -->
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="ViewSuperbillProcedureScrubFullInsurance/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillScrubFullInsurance/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillProcedureScrub/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillScrub/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>


</xsl:stylesheet>

假的
假的
假的
假的
您可以执行以下操作:

<!-- identity transform -->
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="ViewSuperbillProcedureScrubFullInsurance/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillScrubFullInsurance/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillProcedureScrub/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillScrub/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>


</xsl:stylesheet>
应该以相同的方式处理而不是

<!-- identity transform -->
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="ViewSuperbillProcedureScrubFullInsurance/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillScrubFullInsurance/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillProcedureScrub/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>
<xsl:template match="ViewSuperbillScrub/column/@width[not(../@AutoWidth)]">
    <xsl:copy/>
    <xsl:attribute name="AutoWidth">false</xsl:attribute>
</xsl:template>


</xsl:stylesheet>