[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] loading and unloading xml files using xslt


Subject: RE: [xsl] loading and unloading xml files using xslt
From: "Scott Trenda" <Scott.Trenda@xxxxxxxx>
Date: Tue, 18 Dec 2007 13:39:44 -0600

So, just to check:
1. you're operating on a.xml
2. the output comes from a.xml but is affected by b.xml
3. the output doesn't actually contain anything taken from b.xml
4. all of the above takes place within a single transformation.

Correct me if I'm wrong there, but if not, it sounds like you don't want
to "load" b.xml into your result tree at all, but you want to load it as
variable, internal to the transformation. You'd want something like
this:

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

Then you can operate on the nodes from both b.xml and a.xml (your
source):

<xsl:apply-templates select="//a[not(. = $b//a)]"/>

Hope that helps. Remember that you're only operating on the source
document until you tell the processor to do otherwise (e.g.
<xsl:apply-templates select="$b//a"/>), and you're only creating one
result document per transformation. Keep this in mind, and always try to
work with that process flow wherever possible.

~ Scott


-----Original Message-----
From: Senthil Nathan [mailto:rsennat@xxxxxxxxx]
Sent: Tuesday, December 18, 2007 1:03 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] loading and unloading xml files using xslt

It's not that. I would like to load all the nodes from "b.xml"
and then after some operation, I would like to remove the same nodes
which was added from "b.xml".

On Dec 19, 2007 12:17 AM, Alice Wei <ajwei@xxxxxxxxxxx> wrote:
> Hi,
>
>   I have a suggestion here although I am not sure if this is what you
> are trying to do.
>
>   If you want to just load some file by looking for specific nodes
> according to their occurrences, you might want to put in <xsl:if>
> statements, and if the parameter is true, you can do something like
> <xsl:include href="xslt_example_template.xsl" />. If else, then don't
> put in anything.
>
> I hope this helps.
>
> Alice
>
>
> Quoting Senthil Nathan <rsennat@xxxxxxxxx>:
>
> > Hi,
> > I would like to know how to load / unload xml files from the main
xml file.
> >
> > ie. say there is "a.xml", to which I load "b.xml". (means i see the
> > leaf nodes in b.xml
> > and append those in the a.xml").
> > Now, I would like to unload "b.xml" from this. (ie., remove those
> > nodes added earlier).
> > I know this can be done by looking for those specific nodes and
remove
> > it the way i added
> > the child.
> >
> > My question here is, whether all this load / unload can be done
using xslt???
> >
> > Thanks
> > Senthil
> >
> >
>
>
>
> Alice Wei
> MIS 2008
> School of Library and Information Science
> Indiana University Bloomington
> ajwei@xxxxxxxxxxx
> 812-856-2659


Current Thread
Keywords