質問

言していますxmlファイル

<root>
    <node>x</node>
    <node>y</node>
    <node>a</node>
</root>

と以下のように表示する

ayx

のようなものを使った

<xsl:template match="/">
    <xsl:apply-templates select="root/node"/>
</xsl:template>
<xsl:template match="node">
    <xsl:value-of select="."/>
</xsl:template>
役に立ちましたか?

解決

簡単!

<xsl:template match="/">
    <xsl:apply-templates select="root/node">
        <xsl:sort select="position()" data-type="number" order="descending"/>
    </xsl:apply-templates>
</xsl:template>

<xsl:template match="node">
    <xsl:value-of select="."/>
</xsl:template>

他のヒント

これまでに、xsl:並べ替えができます。センターのデータタイプ="番号"が他の位置にソート文字列として、その10ノードge検討して2です。

<xsl:template match="/">
    <xsl:apply-templates select="root/node">
        <xsl:sort 
            select="position()" 
            order="descending" 
            data-type="number"/>
    </xsl:apply-templates>
</xsl:template>
<xsl:template match="node">
    <xsl:value-of select="."/>
</xsl:template>
<xsl:template match="/">
        <xsl:apply-templates select="root/node[3]"/>
        <xsl:apply-templates select="root/node[2]"/>
        <xsl:apply-templates select="root/node[1]"/>
    </xsl:template>
    <xsl:template match="node">
        <xsl:value-of select="."/>
    </xsl:template>
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top