xsl-choose

xslt keep multiple variables in scope depending on a single test

两盒软妹~` 提交于 2019-12-23 02:38:06
问题 I have many variables and only two cases. My original approach goes out of scope : <xsl:choose> <xsl:when test='$something = 6'> <xsl:variable name="foo">x</xsl:variable> <!-- 50 other variables --> </xsl:when> <xsl:when test='$something = 7'> <xsl:variable name="foo">y</xsl:variable> <!-- 50 other variables --> </xsl:when> </xsl:choose> ie. later, with saxon, XPST0008: Variable x has not been declared (or its declaration is not in scope) I think it would work if I would choose inside an xsl

xsl:sort does not work together with xsl:choose or if

筅森魡賤 提交于 2019-12-11 03:25:26
问题 Im going crazy on this XSL problem i have! The thing is that i want to sort newspaper after what is choosen in a FORM. If $sort_newspaper = 'name' and it should sort after name ( <xsl:sort select="./@name"/> )... but... it does not work if the xsl:sort exist inside the choose or after. It also does not work with xsl:if . To be clear it work like the code are now, the choose works... <xsl:for-each select="./newspaper[count(. | key('newspaper_key', ./@id)[1]) = 1]"> <xsl:sort select="./@name"/>

xslt keep multiple variables in scope depending on a single test

吃可爱长大的小学妹 提交于 2019-12-07 16:25:28
I have many variables and only two cases. My original approach goes out of scope : <xsl:choose> <xsl:when test='$something = 6'> <xsl:variable name="foo">x</xsl:variable> <!-- 50 other variables --> </xsl:when> <xsl:when test='$something = 7'> <xsl:variable name="foo">y</xsl:variable> <!-- 50 other variables --> </xsl:when> </xsl:choose> ie. later, with saxon, XPST0008: Variable x has not been declared (or its declaration is not in scope) I think it would work if I would choose inside an xsl:variable tag, but then the tests would be repeated over and over and over and over and over: <xsl