xsl-list
[Top] [All Lists]

RE: Get value from update.xml and stored in source.xml(update source.xml)

2004-09-08 04:56:49
Hi,

Thanks a lot Joris Gillis & David Carlisle

It's working fine with your Techniques. Needs to add "<xsl:value-of
select="count($update/*)"/>" which gives the perfect output. 

Below is the xslt for the same:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:output method="xml" indent="yes"/>

 <xsl:variable name="update" select="document('update.xml')"/> 


<xsl:key name="id" match="*" use="@id"/>

<xsl:template match="/">
<test>
        <source.xml>
                <xsl:copy-of select="/"/>
        </source.xml>
        <source.xml>
                <xsl:copy-of select="$update"/>
        </source.xml>
        <output>
           <xsl:value-of select="count($update/*)"/>
                <xsl:apply-templates/>
        </output>
</test>
</xsl:template>

<xsl:template match="*[(_at_)id]">
        <xsl:variable name="id" select="@id"/>
        <xsl:copy>
                <xsl:apply-templates select="@*" />
                <xsl:comment>Looking up <xsl:value-of
select="local-name()"/> (id = '<xsl:value-of select="@id"/>')</xsl:comment>
                <xsl:comment>With raw xpath:</xsl:comment>
                <xsl:copy-of select="$update//*[(_at_)id=$id]/*"/>
                <xsl:comment>With a key:</xsl:comment>
                <xsl:for-each select="$update">
                        <xsl:copy-of select="key('id',$id)/*"/>
                </xsl:for-each>
        </xsl:copy>
</xsl:template>

<xsl:template match="node()|@*">
        <xsl:copy>
                <xsl:apply-templates select="node()|@*" />
        </xsl:copy>
</xsl:template>

</xsl:stylesheet>   


Thanks,
Shailesh

-----Original Message-----
From: Joris Gillis [mailto:roac(_at_)pandora(_dot_)be] 
Sent: Thursday, September 08, 2005 5:16 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Get value from update.xml and stored in source.xml(update
source.xml)

Tempore 13:42:41, die 09/08/2004 AD, hinc in 
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
scripsit Shailesh <shailesh(_at_)quagnito(_dot_)net>:

Hi,

I am getting output 1:
Ok, that means the problem is solved (what did you do?) and that you can
employ the stylsheet I posted first.

regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Deserta faciunt et innovationem appelant

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--