<xsl:sort>
및 변수를 사용하여 XML 정렬에 관한 스레드를보고 있었지만 여전히 정렬 작업을 수행 할 수 없습니다. 여기에 상황에 대한 몇 가지 XML 구조입니다 :xsl : 변수별로 정렬
<records>
<record>
<contributors>
<authors>
<author>Author 1</author>
<author>Author 2</author>
</authors>
</contributors>
<titles>
<title>I'm a Title!</title>
<secondary-title></secondary-title>
</titles>
<dates>
<year>1901</year>
</dates>
</record>
<record>...</record>
<record>...</record>
</records>
는 그리고 여기에 관련 XSL입니다 : 나는에 문자열을 복사하는 경우
<xsl:variable name="sortby"
select="contributors/authors/author[1]" as="element()*"/>
<xsl:for-each select="//record">
<xsl:sort select="$sortby" order="ascending"/>
[a bunch of HTML to render the records as a bibliography]
</xsl:for-each>
변수의 속성 "선택"이 같은 종류에 붙여 넣습니다
를<xsl:sort select="contributors/authors/author[1]" order="ascending">
그러면 작동합니다. 변수를 사용하면 그렇지 않습니다. 나는 그것을 사용하거나 사용하지 않고 시험해 보았다 as="element()*"
- 도와 줘라?
좋은 질문입니다. +1. 이 문제에 대한 일반적인 XSLT 솔루션이 없다는 대답에 대한 대답은 내 대답을 참조하십시오. 그러나 특정 문제와 유사한 문제의 큰 클래스를 해결하는 유연한 솔루션을 제공합니다. –