[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: Filtering with multiple templates

Subject: Re: Re: Filtering with multiple templates
From: Dongling Ding <dling61@xxxxxxxxx>
Date: Fri, 7 Nov 2003 11:18:10 -0800 (PST)
muenchian multiple templates
Hi Dimitre,

Thanks for the idea of merging two results together.
But the problem is those two results are generated by
program and has no certain order in there. 

In my case, t1 may not be the first. If t1 is after
t2, the result of merge is 

<Member name="x">
	<Member name="w"/>
	<Member name="z"/>
</Member>

It is not the same as the original order(z should be
before w).

I think we want to merge those template results and
also by looking at the original source to make sure
the result of merge is consistent with the original
one.

Any thought would be appreciated!


Dongling

<
--- Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote:
> > We need to allow multiple templates to select some
> of
> > members. for example,
> >
> > the first template will get:
> > <Member name="x">
> >   <Member name="z"/>
> > </Member>
> >
> > the second template will get:
> > <Member name="x">
> >   <Member name="w"/>
> > </Member>
> >
> > If we run this two templates sequentially, we will
> > get:
> > <Member name="x">
> >   <Member name="z"/>
> > </Member>
> > <Member name="x">
> >   <Member name="w"/>
> > </Member>
> >
> > But we want to get the following based on the
> original
> > structure:
> >
> > <Member name="x">
> >   <Member name="z"/>
> >   <Member name="w"/>
> > </Member>
> >
> > Please provide any idea that might help. Thanks a
> lot.
> 
> 
> The output of applying two templates can be merged
> like this:
> 
> This transformation:
> 
> <xsl:stylesheet version="1.0"
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>  xmlns:ext="http://exslt.org/common"
>  exclude-result-prefixes="ext">
> 
>  <xsl:output omit-xml-declaration="yes"
> indent="yes"/>
> 
>   <xsl:template match="/">
>     <xsl:variable name="vrtfOut">
>       <xsl:call-template name="t1"/>
>       <xsl:call-template name="t2"/>
>     </xsl:variable>
> 
>     <xsl:variable name="vOut"
> select="ext:node-set($vrtfOut)/*"/>
>     <xsl:for-each select="$vOut[1]">
>       <xsl:copy>
>         <xsl:copy-of select="@*"/>
>         <xsl:copy-of select="../*/*"/>
>       </xsl:copy>
>     </xsl:for-each>
>   </xsl:template>
> 
>   <xsl:template name="t1">
>     <Member name="x">
>       <Member name="z"/>
>     </Member>
>   </xsl:template>
> 
>   <xsl:template name="t2">
>     <Member name="x">
>       <Member name="w"/>
>     </Member>
>   </xsl:template>
> 
> </xsl:stylesheet>
> 
> when applied on any source.xml (not used), produces:
> 
> <Member name="x">
>    <Member name="z"/>
>    <Member name="w"/>
> </Member>
> 
> 
> =====
> Cheers,
> 
> Dimitre Novatchev.
> http://fxsl.sourceforge.net/ -- the home of FXSL
> 
> 
> 
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.