Re: [xsl] Obtaining xml node value and using it as variable - 2nd attempt

Subject: Re: [xsl] Obtaining xml node value and using it as variable - 2nd attempt
From: Jon Gorman <jonathan.gorman@xxxxxxxxx>
Date: Tue, 4 Oct 2005 14:17:42 -0500
On 10/4/05, geoff hopkins <geoffhopkins123@xxxxxxxxx> wrote:
> reading back I can understand the criticism.
>
> I have one xml document (constants.xml) that contains
> a list of constants.
>
> I want to get node values from this xml
> (constants.xml) document when processing the source
> xml document with a xsl script to get these parameters
> to be used to parse the source xml doc.
>
> i.e. not pass as a command line parameter but for the
> xslt script to be able to obtain paramters from a
> external xml document.

Ummm, somewhat better.  Still not really completely clear.  Some
snippets of the actual constrants file might help some.

So now there is either two cases: 1) constants.xml is an xsl
stylesheet as well, or 2) it contains some xml that need to be in
parameters.

case 1) Have you looked at xsl:import?  Is that causing you problems?


case 2) Have you checked out document()?  That will allow you do to
something like:

<xsl:variable name="constants" select="document(constants.xml)" />

<xsl:parameter name="foo" select="$contants/constant" />

Another option of course is to do something similar to process the
stylesheets and produce a new stylesheet with information from
constants inserted into the newly generated stylesheet, but a lot of
times this is overkill.

Jon Gorman

Current Thread