您好我建立了一个通用模板来列出我的内容.但是Content可以在不同的@或node()上进行排序.所以想要传递xPath.
<xsl:variable name="sort" select="@sortBy"/>
<xsl:variable name="order" select="@order"/>
<xsl:for-each select="Content[@type=$contentType]">
<xsl:sort select="$sort" order="{$order}" data-type="text"/>
<xsl:sort select="@update" order="{$order}" data-type="text"/>
<xsl:copy-of select="."/>
</xsl:for-each>
Run Code Online (Sandbox Code Playgroud)
使用变量以升序或降序进入order=""WORKS.
为什么不能这样做select=""呢?
我希望使这个超级动态的select变量可以是xPtah @publish或Title/node()或任何xPath.
没有错误 - 它只是忽略了排序.