0
如何將四個幾乎相同的模板合併爲一個?我想能夠有一個變量或至少一個地方,我可以指定一組父節點?使用某種選擇器或可能的變量將重複模板合併到單個模板中
我試圖像
<xsl:template match="ViewSuperbillProcedureScrubFullInsurance|ViewSuperbillScrubFullInsurance|ViewSuperbillProcedureScrub|ViewSuperbillScrub/column/@width[not(../@AutoWidth)]">
或
<xsl:template match="*[ViewSuperbillProcedureScrubFullInsurance|ViewSuperbillScrubFullInsurance|ViewSuperbillProcedureScrub|ViewSuperbillScrub]/column/@width[not(../@AutoWidth)]">
或
<xsl:varname name="NodeList">ViewSuperbillProcedureScrubFullInsurance|ViewSuperbillScrubFullInsurance|ViewSuperbillProcedureScrub|ViewSuperbillScrub</xsl:varname>
<xsl:template match="$NodeList/column/@width[not(../@AutoWidth)]">
但沒有任何工程。
下面是完整的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>