1

xmlを変換することでいくつか問題が発生しました。子ノードを正しい順序でハイブオフしたいと思います。

要素の現在のネスト(/ノード)

<span style="font-family: [Ohne];">
   <span style="font-family: qwe;">etu</span>
   <!-- hive off this nested child-node above the parent -->
   restia volorsin  
</span>

意図されたネストと要素の順序(/ノード)

<!-- after xslt -->
<span style="font-family: [Ohne];">restia volorsin</span>
<span style="font-family: qwe;">etu</span>

サンプルコードをもっと見る

誰かが私にいくつかのヒントをくれましたか?

4

1 に答える 1

1

これと同じくらい簡単

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output omit-xml-declaration="yes" indent="yes"/>
 <xsl:strip-space elements="*"/>

 <xsl:template match="span[span]">
  <xsl:copy>
       <xsl:copy-of select="@*|node()[not(self::span)]"/>
  </xsl:copy>
  <xsl:copy-of select="span"/>
 </xsl:template>
</xsl:stylesheet>

この変換が提供されたXMLドキュメントに適用される場合:

<span style="font-family: [Ohne];">
   <span style="font-family: qwe;">etu</span>
   <!-- hive off this nested child-node above the parent -->
   restia volorsin
</span>

必要な正しい結果が生成されます:

<span style="font-family: [Ohne];"><!-- hive off this nested child-node above the parent -->
   restia volorsin
</span>
<span style="font-family: qwe;">etu</span>
于 2012-10-26T14:05:19.030 に答える