Can you simulate a boolean flag in XSLT?

Posted by R.C. on Stack Overflow See other posts from Stack Overflow or by R.C.
Published on 2010-04-14T21:44:20Z Indexed on 2010/04/14 21:53 UTC
Read the original article Hit count: 185

Filed under:

Hey guys,

I'd like to simulate a flag in an xslt script. The idea is for template foo to set a flag (or a counter variable, or anything), so that it can be accessed from template bar. Bar isn't called from foo, but from a common parent template (otherwise I would pass a parameter to it). The structure is like this:

<xsl:template match="bla">
  <xsl:apply-templates select="foo"/> <!-- depending on the contents of foo... -->
  <xsl:apply-templates select="bar"/> <!-- ... different things should happen in bar -->
</xsl:template>

Any tricks are much appreciated.

© Stack Overflow or respective owner

Related posts about xslt