Re: [xsl] Replacing values in xml files.....

Subject: Re: [xsl] Replacing values in xml files.....
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Thu, 3 Jan 2008 16:17:23 +0530
I would not like to correct the low level details of your code. I want
you to think about that ...

But I would be happy to share know how about the 'document' function
and it's usage.

Please find below a small program illustrating the same.

Let the following XML document be named, delta.xml:

  <p id="p1">text</p>

The following stylesheet is applied to the other (the big one) XML document:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="";>
    <xsl:output method="html"/>
    <xsl:variable name="delta" select="document('delta.xml')"/>
    <xsl:template match="/">
             <xsl:for-each select="//edition">
                <xsl:variable name="x" select="." />
                        <xsl:value-of select="@language" />
	           <xsl:when test="$x = $delta/chapter/p/@id">
	              <xsl:value-of select="$delta/chapter/p[@id = $x]" />
	              <xsl:value-of select="$x" />
	           </xsl:otherwise>						        </xsl:choose>

Please run this stylesheet with a XSLT processor, and you can see the output.

PS: The 'document' function can get a reference to an external XML
document (other than the primary one, which is supplied to the
transformation process). You can refer any number of external XML
documents, and store each one in a variable in the stylesheet.

On Jan 2, 2008 4:39 PM, Mujahid - E - Azam <mujahidazam@xxxxxxxxxxxx> wrote:
> Can you please help me with the syntax...
> Also can you please go through the xsl at the bottom and let me know if I am
> going in the right direction....
> Thanks & Regards,
> Mujahid E Azam

Mukul Gandhi

Current Thread