Subject: RE: HELP ME! Getting xml filename and node path from diffrent xml document. From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 29 Aug 2000 10:55:17 +0200 (MET DST) |
Good Morning Anders, > (doc1.xml) > > <xml> > <textbox> > <name>name</name> > <value>/xml/adressbook/entry/name</value> > </textbox> > </xml> > > > (doc2.xml) > > <xml> > <adressbook> > <entry> > <name>Anders Carlberg</name> > </entry> > </adressbook> > </xml> > > > > Note that the value text() in doc1.xml is the "path" to the name in > doc2.xml. > My question is. How can i use a xsl to get a result that would look somthing > like this. > <xml> > <textbox name="name" value="Anders Carlberg" /> > </xml> The following stylesheet works with Saxon: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://icl.com/saxon" exclude-result-prefixes="saxon" version="1.0"> <!-- Source1: given as processed XML source: contains XPaths --> <!-- Source2: given via parameter : contains Names --> <xsl:param name="file2" /> <xsl:variable name="doc2" select="document($file2)" /> <xsl:template match="xml"> <xml> <xsl:apply-templates /> </xml> </xsl:template> <xsl:template match="textbox"> <textbox name="{name}" value="{saxon:evaluate(concat('$doc2',value))}" /> </xsl:template> </xsl:stylesheet> Invoking: saxon doc1.xml anders.xsl file2=doc2.xml I hope you understand this code. If you still have questions, feel free to ask. As I said in the last post: it's an extension of Saxon, it's not possible in the XSLT standard. > Im using Xalan today, but it dosen't matter what i use. > (Xalan implements xsl and xpath spec i think). > I havent used saxon at all, so im going to take a look now. I'm not that familiar with Xalan. If it implements a similiar extension, maybe somebody on this list can comment. Best regards, Oliver /-------------------------------------------------------------------\ | ob|do Dipl.Inf. Oliver Becker | | --+-- E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx | | op|qo WWW: http://www.informatik.hu-berlin.de/~obecker | \-------------------------------------------------------------------/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Newbie help needed BAD!!!, Oliver Becker | Thread | Selectively displaying numbers, Mick |
Re: Newbie help needed BAD!!!, Mike Brown | Date | Re: Newbie help needed BAD!!!, Oliver Becker |
Month |