잘 작동하는 다음 XSLT 세그먼트가 있습니다. @status varibale에 따라 주어진 색상의 요소를 생성합니다.xsl 사용 : 단일 요소 특성 업데이트를 선택하십시오.
문제는 매우 비현실적입니다. 모든 xsl : 섹션에서 같은 값을 반복합니다.
<xsl:template match="Task">
<xsl:choose>
<xsl:when test="@status = 'Completed'">
<task name="{@title}" processId="{@resourceId}" start="{@start}" end="{@end}" Id="{@id}" color="006d0f" borderColor="E1E1E1" />
</xsl:when>
<xsl:when test="@status = 'Failed'">
<task name="{@title}" processId="{@resourceId}" start="{@start}" end="{@end}" Id="{@id}" color="FF0000" borderColor="E1E1E1" />
</xsl:when>
<xsl:when test="@status = 'Risk'">
<task name="{@title}" processId="{@resourceId}" start="{@start}" end="{@end}" Id="{@id}" color="FF9900" borderColor="E1E1E1" />
</xsl:when>
<xsl:when test="@status = 'OnGoing'">
<task name="{@title}" processId="{@resourceId}" start="{@start}" end="{@end}" Id="{@id}" color="14f824" borderColor="E1E1E1" />
</xsl:when>
<xsl:otherwise>
<task name="{@title}" processId="{@resourceId}" start="{@start}" end="{@end}" Id="{@id}" color="e8e8e8" borderColor="E1E1E1" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
변경할 수있는 유일한 것은 색상 속성입니다.
하나의 작업 요소를 가지고 xsl : color 속성 만 업데이트 할 수있는 방법이 있습니까? 하나 개의 속성 노드가 <xsl:attribute>
를 사용하여 그냥 사전에
감사합니다 ...
고마워! 그게 내가 필요한거야. –