0

My issue is very similar to this one:

XSLT: use parameters in xls:sort attributes (dynamic sorting)

But I'd like to sort it by node's attribute. How to change this command:

<xsl:sort select="*[name()=$sortBy]" order="{$order}"/>

so that instead of name() function, there would be comparison to names of attributes? Or is there any other way to (dynamically according to given parameter) sort nodes by their attributes?

1 Answer 1

3

Use <xsl:sort select="@*[name()=$sortBy]" order="{$order}"/>, that is all that is needed.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot! I didn't expect such an easy solution of such a complicated language! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.