Subject: RE: [xsl] RE: Replacing values in one xml file from another xml file From: "Mujahid - E - Azam" <mujahidazam@xxxxxxxxxxxx> Date: Fri, 28 Dec 2007 16:36:17 +0530 |
Hi All, This is the xsl that I have come up with so far.... <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="http://www.stylusstudio.com/xquery"> <xsl:param name="input1" select="document('file:///c:/Documents%20and%20Settings/Administrator/Deskto p/source.xml')"/> <xsl:template match="/"> <html> <head/> <body> <xsl:variable name="DefaultDocument" select="."/> <div style="text-align: none;"> <table align="none" style="border-style: outset;border-width: 2pt;width: 100%;background-repeat: repeat" cellspacing="1pt"> <tbody> <tr> <td style="border-style: inset;border-width: 2pt;;vertical-align: middle;background-repeat: repeat"> <div style="text-align: none;"> <div> <div style="text-align: none;"> <xsl:value-of select="$DefaultDocument/wikimedia/projects/project"/> <xsl:for-each select="$DefaultDocument//wikimedia/projects/project"> <xsl:variable name="project" select="."/> <div> <div style="text-align: none;"> <xsl:value-of select="@name"/> </div> </div> </xsl:for-each> <xsl:for-each select="$DefaultDocument//wikimedia/projects/project"> <xsl:variable name="project1" select="."/> <div> <div style="text-align: none;"> <xsl:value-of select="@launch"/> </div> </div> </xsl:for-each> <xsl:for-each select="$DefaultDocument//wikimedia/projects/project"> <xsl:variable name="project2" select="."/> <div> <div style="text-align: none;"> <xsl:value-of select="editions"/> </div> </div> </xsl:for-each> <xsl:for-each select="$DefaultDocument//wikimedia/projects/project"> <xsl:variable name="project3" select="."/> <div> <div style="text-align: none;"> <xsl:value-of select="editions/edition"/> </div> </div> </xsl:for-each> <xsl:for-each select="$DefaultDocument//wikimedia/projects/project"> <xsl:variable name="project4" select="."/> <div> <div style="text-align: none;"> <xsl:for-each select="editions/edition"> <xsl:variable name="edition" select="."/> <div> <div style="text-align: none;"> <xsl:value-of select="@language"/> </div> </div> </xsl:for-each> <xsl:value-of select="$input1/chapter/p"/> </div> </div> </xsl:for-each> </div> </div> </div> </td> <td style="border-style: inset;border-width: 2pt;;vertical-align: middle;background-repeat: repeat"> <div style="text-align: none;"/> </td> <td style="border-style: inset;border-width: 2pt;;vertical-align: middle;background-repeat: repeat"> <div style="text-align: none;"/> </td> </tr> </tbody> </table> </div> </body> </html> </xsl:template> </xsl:stylesheet> Thanks & Regards, Mujahid E Azam -----Original Message----- From: Abel Braaksma [mailto:abel.online@xxxxxxxxx] Sent: Friday, December 28, 2007 1:56 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] RE: Replacing values in one xml file from another xml file You don't really elaborate on my solution (as Mukul pointed out already), you basically repeat what you already said. If you use a auto-generated stylesheet, you will probably have to tweak it yourself a bit. But if you are completely new to XSLT, it is best to first start with a little test by hand, not with a big one that is auto-generated as it may contain many advanced concepts. If you have specific problems with applying my solution, show what you tried and then we can help from there. (Btw, if you answer to the list it is generally best to answer only to the list and not to the people directly (you accidentally CC'ed Mukul in your mail).) Cheers, -- Abel Braaksma Mujahid - E - Azam wrote: > HI, > > I have two xml files.... (xsl below....) > > ************* 1 *************** > <?xml version="1.0" encoding="UTF-8"?> > <wikimedia> > <!--><xsi:noNamespaceSchemaLocation="Inclusion.xsd">--> > <projects> > <project name="Wikipedia" launch="2001-01-05"> > <editions> > <edition language="English">p1</edition> > <edition language="German">de.wikipedia.org</edition> > <edition language="French">fr.wikipedia.org</edition> > <edition language="Polish">en.wikipedia.org</edition> > </editions> > </project> > <project name="Wiktionary" launch="2002-12-12"> > <editions> > <edition language="English">en.wiktionary.org</edition> > <edition language="French">fr.wiktionary.org</edition> > <edition language="Vietnamese">vi.wiktionary.org</edition> > <edition language="Turkish">tr.wiktionary.org</edition> > </editions> > </project> > </projects> > </wikimedia> > > ************end of 1**************** > > and > > *****************2**************** > > <?xml version="1.0" encoding="UTF-8"?> > <chapter> > <p id="p1">text</p> > </chapter> > > *********end of 2**************** > > If you see the 1 st xml file > > At the node wikimedia\ projects\ project\ editions\ edition > language="English" in the place of p1. I should get value from the second > xml file ----- chapter\<p id="p1"> "text". > > When I run an xslt and get the data from 1st xml in the place of p1. I > should get text displayed.. > I mean it should be linked to the chapter\<p id="p1"> "text". Field of > source.xml.. > please let me know how to do this..... > > The xsl generated by me using stylus studio... > I am not sure if this is even correct.. I am completely new to xsl... so...
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] RE: Replacing values in o, Abel Braaksma | Thread | [xsl] Can Saxon validate an XML doc, Ben Stover |
Re: [xsl] Table type output in text, Jesper Tverskov | Date | [xsl] Can Saxon validate an XML doc, Ben Stover |
Month |