Re: [xsl] Filtering new tags

Subject: Re: [xsl] Filtering new tags
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Fri, 25 Jan 2008 12:00:26 +0530
I think, you want (records from new file - records from old file),
i.e. difference.

Your stylesheet looks fine to me. I get correct output with Xalan-J 2.7.1.

Probably, you need to explain more clearly about the requirement.

On 1/25/08, buddhi <buddhi@xxxxxxxxxxxxxxxxxxx> wrote:
> Hi
>
> I have a xml file with following tag sets
>
>  <data name="DE">
>     <value>Drawing Editor</value>
>     <comment>DE</comment>
>   </data>
>
> I have two xml files with this, but both are not equivalent. One is a
> old file and other one is the new file, where set of those tag set are
> added here and there in the doc (not only to the end of the document) I
> wanted to extract those newly added tag sets to a separate file after
> transformation. I mad ea one XSL, but it takes the old file and append
> new tags to it. I want only the new tags.
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> version="1.0">
>   <xsl:variable name="old-doc" select="document('old.xml')" />
>   <xsl:template match="/root">
>     <newtags>
>       <xsl:for-each select="data">
>         <xsl:variable name="temp" select="." />
>         <xsl:if test="not($old-doc/root/data[@name = $temp/@name])">
>           <xsl:copy-of select="$temp" />
>         </xsl:if>
>       </xsl:for-each>
>     </newtags>
>   </xsl:template>
> </xsl:stylesheet>
>
>
> Please help me on this.
>
> - Buddhi -



-- 
Regards,
Mukul Gandhi

Current Thread