[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hi Ann Marie,
At 03:57 PM 11/12/2004, you wrote:
Okay.
Not really, no (or not without really scratching your ear with your elbow, as we like to say at Mulberry). But if you could make those parameters accessible as a node-set instead of as a set of parameters, you could.
You'd want them available in a form something like:
(Typically we put such things in an external document which we access from the stylesheet with the document() function.)
This gives you a "hash table" or "array" in the form of a node-set, which you could query into. The FAQ discusses this kind of thing under the heading "lookup table", I think.
Re: [xsl] looping through global parameters
Subject: Re: [xsl] looping through global parameters From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 12 Nov 2004 16:03:58 -0500 |
Hi Ann Marie,
At 03:57 PM 11/12/2004, you wrote:
I have a stylesheet that defines 2 global parameters: attr and value. The stylesheet has a template that matches all attributes, and if the current attribute name matches the global attr, outputs value.
<xsl:template match="@*" priority="10"> <xsl:attribute name="{name()}">
<xsl:choose> <xsl:when test="name()=$attr"><xsl:value-of select="$value"/></xsl:when> <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise> </xsl:choose> </xsl:attribute> </xsl:template>
Okay.
Requirements have changed and now the calling process will parse the stylesheet to write a set of global parameters for the values that need to be updated, like so:
<xsl:param name="attr">temporary-directory</xsl:param> <xsl:param name="value">/var/temp</xsl:param> <xsl:param name="attr1">search-local-classes-first</xsl:param> <xsl:param name="value1">false</xsl:param> . . .
Is there a way to loop through the global attributes and call the template for each one?
Not really, no (or not without really scratching your ear with your elbow, as we like to say at Mulberry). But if you could make those parameters accessible as a node-set instead of as a set of parameters, you could.
You'd want them available in a form something like:
<attributes> <attr name="temporary-directory">/var/temp</attr> <attr name="search-local-classes-first">false</attr> </attributes>
(Typically we put such things in an external document which we access from the stylesheet with the document() function.)
This gives you a "hash table" or "array" in the form of a node-set, which you could query into. The FAQ discusses this kind of thing under the heading "lookup table", I think.
Cheers, Wendell T
Thanks,
Ann Marie
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] looping through global parame, Ann Marie Rubin | Thread | Re: [xsl] looping through global pa, Geert Josten |
[xsl] looping through global parame, Ann Marie Rubin | Date | Re: [xsl] looping through global pa, Geert Josten |
Month |
Keywords