xsl-list
[Top] [All Lists]

RE: Merging two xml documents using xslt

2005-02-01 11:24:39
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(_at_)xxxxxxxxxxxxxxxxxxxxxx 
Subject:  RE: [xsl] Merging two xml documents using xslt 
From:  cknell(_at_)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 
[(_at_)xpath="/employee/address/country" ]/@xvalue from the external document 
as

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

which should return the string "USA".
-- 
Charles Knell
cknell(_at_)xxxxxxxxxx - email




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--