xslt: is xsl:if syntax sugar?


XML & Web services: xslt: is xsl:if syntax sugar?

  1. xslt: is xsl:if syntax sugar? (2 messages)

    a bit of theory after all the working class problems ;) is xsl:if syntax sugar? can you replace .... by something like this .... ??? is the test expression you can use in the square brackets somehow limited? can you copy the content of the xsl:if element to the 'if_template' as it is or do you have to modify it(and maybe its context) to keep the semantics?

    Threaded Messages (2)

  2. Won't work - variables[ Go to top ]

    It won't work because you can't use template-local variables in the expression, which is a common thing to do. Cheers, Tony.
  3. no, it's not[ Go to top ]

    xsl:if is not syntax sugar. why the above mentioned proposal doesn't work? the test expression in xsl:if evaluates in a context with current node list containing nodes selected in apply-templates *up the stack*. the match pattern containing a predicate [...] is evaluated in a context with "siblings of the context node that match the NodeTest as the context node list". if you use the select attribute in apply-templates to select anything else than all siblings(and nothing else) or if you use xsl:sort, these two contexts have different context node lists. if you don't use @select, the lists are identical, but you can't use variables in patterns and so you can't use it in xsl:if test expr for the proposal to work.