[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Merging two xml documents using xslt

Subject: RE: Merging two xml documents using xslt
From: Jianyu Lai <jlai@xxxxxxxx>
Date: Tue, 1 Feb 2005 10:24:39 -0800
merging two xml documents
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:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.