저는 XSLT의 기본 사항을 잘 알고 있지만 이상한 상황에 처했습니다. 알아낼 수 없습니다. 이 일이 너무 오래되어 사과 드리지만 제공 할 수있는 도움에 정말 감사드립니다.여러 요소로 정렬
나는 당신이 연결을 한 후 이순신 종류의 Level_5에게
XML unsorted:
<Root att="x">
<Level_1 Name="NEW Level">
<Level_2>
<Level_3 Name="nameLvl_3">
<Level_4>
<Level_5 Name="aa">
<Brand>
<Value Name="Text" Value="1" />
</Brand>
<Docs>
<Value Name="Pro" Value="2" />
<Value Name="Numeric" Value="0.05" />
</Docs>
</Level_5>
<Level_5 Name="aa">
<Text>
<Val Id="1"/>
</Text>
</Level_5>
<Level_5 Name="aa">
<Brand>
<Value Name="Text" Value="2" />
<Value Name="Number" Value="1" />
<Value Name="Long" Value="3" />
</Brand>
</Level_5>
</Level_4>
</Level_3>
</Level_2>
</Level_1>
</Root>
당신이해야 있도록 정렬 된 브랜드/가치/@ 이름과 문서/가치/@ 이름의 연결을 기반으로, Level_5 노드를 정렬하려면 ""LongNumberText는 TextNumericPro 과 예상 출력은 다음과 같습니다
<Root att="x">
<level_1 Name="NEW Level">
<level_2>
<Level_3 Name="nameLvl_3">
<Level_4>
<Level_5 Name="aa">
<Text>
<Val Id="1"/>
</Text>
</Level_5>
<Level_5 Name="aa">
<Brand>
<Value Name="Long" Value="3" />
<Value Name="Number" Value="1" />
<Value Name="Text" Value="2" />
</Brand>
</Level_5>
<Level_5 Name="aa">
<Brand>
<Value Name="Text" Value="1" />
</Brand>
<Docs>
<Value Name="Numeric" Value="0.05" />
<Value Name="Pro" Value="2" />
</Docs>
</Level_5>
</Level_4>
</Level_3>
</Level_2>
</Level_1>
</Root>
내가 할 수있는 유일한 종류의 난의 나머지 부분을 연결하는 방법을 어떤 생각이없는/브랜드/가치/@ 이름의 첫 번째 요소에 의해서가 아니라 브랜드 및 문서 도구 내부의 속성입니다.이 코드는 NG :
<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="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Level_3/Level_4/Level_5/Brand|Docs">
<xsl:copy>
<xsl:apply-templates>
<xsl:sort select="@Name" data-type="text"/>
<xsl:sort select="@Value" data-type="text"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<!-- -->
<xsl:template match="Level_2/Level_3/Level_4">
<xsl:copy>
<xsl:apply-templates select="Level_5">
<xsl:sort select="Brand|Docs/Value/@Name" data-type="text"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
하지만 난 그것을 그저 안녕 브랜드의 내부 또는 문서가 어떤 도움을 기쁘게 첫 번째 요소
이미 두 단계로 진행하지만 한 단계로 제한됩니다. – user1789798