a global variable sure would come in handy

D

David Schwartz

I need to control how I process <foo> elements based on how I'm
generating my HTML (separate files vs. a single large file). What can
I use as a switch in my foo stylesheet to control how it's processed?
Note that the output style is determined by which xsl file (which
'include' the foo stylesheet) I process rather than being represented
in the xml data.

As the foo stylesheet uses the 'match' attribute, I don't know how to
make the output style detectable within the stylesheet. If I was
coding in other languages, I'd be tempted to use a global variable.

TIA,
David
 
M

Martin Honnen

David said:
I need to control how I process <foo> elements based on how I'm
generating my HTML (separate files vs. a single large file). What can
I use as a switch in my foo stylesheet to control how it's processed?
Note that the output style is determined by which xsl file (which
'include' the foo stylesheet) I process rather than being represented
in the xml data.

As the foo stylesheet uses the 'match' attribute, I don't know how to
make the output style detectable within the stylesheet. If I was
coding in other languages, I'd be tempted to use a global variable.

Well XSLT knows both global variables and global parameters and with
XSLT 2.0 you can even use them in match patterns:
<xsl:stylesheet
xmlns:xsl="http://wwww.w3.org/1999/XSL/Transform"
version="2.0">

<xsl:param name="multiple" select="true()"/>

<xsl:template match="foo[$multiple]">
...
</xsl:template>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top