0
我很新的XSL概念,我試圖創建下面的XML格式的XSLT,手動創建XSLT
<?xml version="1.0" encoding="UTF-8"?>
<row>
<c1>1234</c1>
<c2>A</c2>
<c2 m="1" s="2">321</c2>
<c2 m="1" s="3">654</c2>
<c2 m="1" s="4">098</c2>
<c2 m="2">B</c2>
<c2 m="3">C</c2>
<c2 m="3" s="2">123</c2>
<c2 m="4">5</c2>
<c3 />
</row>
如果變換使用XSL那麼我應該得到的輸出如下所示,
1234 A \ 321 \ 654 \ 098] b]ç\ 123] 5
我試圖創建自己如下,
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="row">
<array />
<xsl:apply-templates />
</xsl:template>
<xsl:template match="c1">
<data>
<xsl:attribute name="attribute">1</xsl:attribute>
<xsl:attribute name="value">
<xsl:number level="single" />
</xsl:attribute>
<xsl:attribute name="subvalue">1</xsl:attribute>
<xsl:value-of select="." />
</data>
</xsl:template>
<xsl:template match="c2">
<data>
<xsl:attribute name="attribute">1</xsl:attribute>
<xsl:attribute name="value">
<xsl:number level="single" />
</xsl:attribute>
<xsl:attribute name="subvalue">1</xsl:attribute>
<xsl:value-of select="." />
</data>
</xsl:template>
</xsl:stylesheet>
b UT我得到的輸出如下,
1234 A 321 654 098 B C 123 5
請幫我在創建XSL
提供的XSLT從XML到XML的轉換,而不是XML文本。是否有使用後續變壓器?你在尋找'xsl:text'嗎? – Mitch
@Arunkumar你能解釋一下你用來在輸出中獲得']和\的邏輯嗎? –
@Mitch我沒有使用任何其他變壓器。正如我告訴過你對XSL非常新,所以如果使用xsl:text,我所要求的輸出可以達到,那麼我很高興。 – Arunkumar