all groups > dotnet xml > january 2005 >
You're in the

dotnet xml

group:

Possible to include other tags in a XSLT file?


Possible to include other tags in a XSLT file? Richard L Rosenheim
1/31/2005 3:11:03 AM
dotnet xml:
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>

TIA,

Richard Rosenheim

Re: Possible to include other tags in a XSLT file? Richard L Rosenheim
1/31/2005 10:24:25 AM
Thanks..it works (after correcting my typing mistakes :) ) !

Richard Rosenheim


[quoted text, click to view]

Re: Possible to include other tags in a XSLT file? Oleg Tkachenko [MVP]
1/31/2005 3:46:20 PM
[quoted text, click to view]

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]
AddThis Social Bookmark Button