xsl-list
[Top] [All Lists]

Re: [xsl] Combine two diff xmls - Sorting by date

2008-05-29 03:35:36
We are using xslt processor of vignette portal. I
think it supports node-set function as I
am seeing the use of this function in other xsl files.

There are two xml files (File1.xml and File2.ml)

There is already a complicated xsl build on File2.xml.
 So I don't want to change File2.xml.

If I understand correctly, you are suggesting to do: 
Step1: change File1.xml into File2.xml format. Let's
say it is File3.xml
Step2: combine both the xmls --> 

From xsl of File2.xml:
         <xsl:apply-templates select="* |
document('File3.xml')/*"/>  ==> IS THIS CORRECT?
Step3: Now File2Xsl contains File2.xml and File3.xml

Step4: But when I process combined XML, each XML is
getting processed as two files. I
am not seeing one x


<?xml version="1.0" encoding="UTF-8"?> ===> file2.xml
<Annoucements>
    <announcement>
        <anc_date>2008-03-11</anc_date>
        <anc_title>Annoucement Title1</anc_title>
    </announcement>
    <announcement>
        <anc_date>2008-07-14</anc_date>
        <anc_title>Annoucement Title2</anc_title>
    </announcement> 
</Annoucements>
<?xml version="1.0" encoding="UTF-8"?> ===> file3.xml
<Annoucements>
    <announcement>
        <anc_date>2008-04-11</anc_date>
        <anc_title>Annoucement Title3</anc_title>
    </announcement>
    <announcement>
        <anc_date>2008-08-14</anc_date>
        <anc_title>Annoucement Title4</anc_title>
    </announcement> 
</Annoucements>

How do I see them as:

<Annoucements>
    <announcement>
        <anc_date>2008-03-11</anc_date>
        <anc_title>Annoucement Title1</anc_title>
    </announcement>
    <announcement>
        <anc_date>2008-07-14</anc_date>
        <anc_title>Annoucement Title2</anc_title>
    </announcement> 
    
    
    <announcement>      ====> NEWLY ADDED FROM File3.xml
        <anc_date>2008-04-11</anc_date>
        <anc_title>Annoucement Title3</anc_title>
    </announcement>
    <announcement>
        <anc_date>2008-08-14</anc_date>
        <anc_title>Annoucement Title4</anc_title>
    </announcement>     
    
</Annoucements>

If I can see like the above xml, then I can do sorting
and other transformations on the whole
(File1+File2.xmls) together.

-Sudhehsna
--- Martin Honnen <Martin(_dot_)Honnen(_at_)gmx(_dot_)de> wrote:

sudheshna iyer wrote:

How can achieve this?

One way would be to process in two steps, first
build a result tree 
fragment of elements where you transform the
different elements into the 
same structure, then use exsl:node-set or similar to
get a node-set that 
you can sort and output.
Which XSLT processor do you use, does it support
exsl:node-set or a 
similar extension function to convert a result tree
fragment into a 
node-set?

-- 

      Martin Honnen
      http://JavaScript.FAQTs.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>
--~--





      

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

<Prev in Thread] Current Thread [Next in Thread>