RE: [xsl] Merging two xml documents using xslt

Subject: RE: [xsl] Merging two xml documents using xslt
From: Jianyu Lai <jlai@xxxxxxxx>
Date: Tue, 1 Feb 2005 10:24:39 -0800
Charles,

Thanks for the reply. I see your point, however, the xapth/xvalue in
updates.xml is dynamic - the xslt doesn't know what it is until run time.

I guess my question is essentially how to pass a list of xpath/xvalue (from
one document) to xslt, and use that to update the source xml document based
on the criteria I described below. I heard xslt cannot take dynamic xpath as
parameter, but in this case, I want xslt to treat these xpath as literal
strings (got the idea from a thread here titled "yet another XPath
question").  But I just cannot get the dynamic xpath strings part going.

Thanks,
Jianyu Lai

---------------------------------------------------------------------------
To:  xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
Subject:  RE: [xsl] Merging two xml documents using xslt 
From:  cknell@xxxxxxxxxx 
Date:  Tue, 01 Feb 2005 12:48:24 -0500 

I don't think I see enough of your files to give you a complete answer, but
you 
can read the external file into the XSLT with the document() function, as in

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

>From this point on in your XSLT file, you can refer the value of
/updates/elem 
>[@xpath="/employee/address/country" ]/@xvalue from the external document as

<xsl:value-of select='$updates/updates/elem
[@xpath="/employee/address/country" 
]/@xvalue' />

which should return the string "USA".
-- 
Charles Knell
cknell@xxxxxxxxxx - email

Current Thread