Richard L Rosenheim wrote:
Is it possible to include addition tags in a XSLT file, that the XSLT
processor will, for all practical purposes, ignore?
What I'm looking to do is to include a section to contain information
regarding what parameters the XSLT file is expecting. Then my program can
retrieve the information from the style sheet and prompt the user for the
necessary parameters. I'm envisioning the section would be something like
this:
<myParameters>
<Param name="City" prompt="City to search for" />
<Param name="State" prompt="State to search for" />
</myParameters>
Sure you can do it. XSLT spec explicitly allows elements in non-XSLT
namespaces (excluding empty namespace) to be at stylesheet's top level
(children of xsl:stylesheet). That's quite common XSLT technique usually
called embedded lookup table:
<xsl:stylesheet ... xmlns:my="http://my.com">
<my:Parameters>
<Param name="City" prompt="City to search for" />
<Param name="State" prompt="State to search for" />
</my:Parameters>
....
And then you can query this embedded XML content using document()
function with empty string as an argument:
<xsl:variable name="term" select="'City'"/>
<xsl:value-of
select="document('')/*/my:Parameters/Param[@name=$term]/@prompt"/>
--
Oleg Tkachenko [XML MVP, MCP]
http://blog.tkachenko.com