0
我有工作的XSLT,它搜索特定的元素/属性组合并(1)将元素重命名为搜索属性值(2)添加包含原始元素的属性名称和(3)删除搜索属性。我有这方面的工作具有相同的属性名称的两个不同的搜索元素,但要使它成为一个单一的或运算比赛匹配多个OR值,但知道何时使用XSLT
<xsl:template match="Values/Value|MultiValue">
有没有一种方法来“捕获”比赛的顺序值,以避免必须在下面的XSLT中为StepClass属性提供特定的属性值?我尝试了价值,但这是抓住元素价值。
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- identity transform -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<!-- Change Values/Value value of AttributeID -->
<xsl:template match="Values/Value">
<xsl:element name="{@AttributeID}">
<xsl:attribute name="StepClass">Value</xsl:attribute>
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
<!-- Change MultiValue to value of AttributeID -->
<xsl:template match="MultiValue">
<xsl:element name="{@AttributeID}">
<xsl:attribute name="StepClass">MultiValue</xsl:attribute>
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
<!--empty template suppresses this attribute-->
<xsl:template match="@AttributeID" />
正是我在找的东西!不够感谢你!我想我需要更好地说出我的问题.... – sawmkw