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

Re: fastest way to do projection in xsl

Subject: Re: fastest way to do projection in xsl
From: "Kasper Nielsen" <news@xxxxxx>
Date: Thu, 7 Nov 2002 12:16:26 +0100
kasper kav nielsen
What can I say Joerg!
Thanks a million this was exactly what I was looking for!

regards
  Kasper
----- Original Message -----
From: "Joerg Heinicke" <joerg.heinicke@xxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, November 07, 2002 2:01 AM
Subject: Re:  fastest way to do projection in xsl


> Hello Kasper,
>
> a nice and short stylesheet already solves your problem. It contains
> only of the identity transformation template (copies everyting to the
> output, that is matched), a template for all (to not copy the view) and
> a template matching on the project elements, that contains the important
> logic.
>
> <xsl:template match="all">
>      <xsl:apply-templates select="projects"/>
> </xsl:template>
>
> <xsl:template match="project">
>      <xsl:copy>
>          <xsl:variable name="thisProject" select="."/>
>          <xsl:for-each select="/all/view/columns/measure">
>              <xsl:apply-templates select="$thisProject/measure[@name =
> current()/@name]"/>
>          </xsl:for-each>
>      </xsl:copy>
> </xsl:template>
>
> <xsl:template match="@*|node()">
>      <xsl:copy>
>          <xsl:apply-templates select="@*|node()"/>
>      </xsl:copy>
> </xsl:template>
>
> I think it's easy to understand, isn't it?
>
> Regards,
>
> Joerg
>
> Kasper Nielsen wrote:
> > Hello,
> >
> > Basicly what im looking for is how to (fastest possible way) do a
project
> > (relational algebra) operation on a long list of relations in xsl
> >
> > Let's say I have this document
> >
> > <all>
> >
> >     <view name="economy">
> >         <columns>
> >             <measure name="economy_estimate"/>
> >             <measure name="economy_actual"/>
> >             <measure name="responsible"/>
> >         </columns>
> >     </view>
> >
> >     <projects>
> >         <project>
> >             <measure name="responsible"> kav </measure>
> >             <measure name="economy_actual">991233</measure>
> >             <measure name="economy_estimate">881123</measure>
> >             <measure name="schedule_actual">123</measure>
> >             <measure name="schedule_estimate">823</measure>
> >         </project>
> >         <project>
> >             <measure name="responsible"> pjc </measure>
> >             <measure name="economy_actual">77123123</measure>
> >             <measure name="economy_estimate">44123123</measure>
> >             <measure name="schedule_actual">723</measure>
> >             <measure name="schedule_estimate">923</measure>
> >         </project>
> >         ..... 100's of other projects....
> >     </projects>
> > </all>
> >
> > how do I transform this document into something like this with xsl
> > The order between measures is as defined in the view part, ie (estimate
> > before actual) before responsible
> >
> > <projects>
> >   <project>
> >     <measure name="economy_estimate">881123</measure>
> >     <measure name="economy_actual">991233</measure>
> >     <measure name="responsible"> kav </measure>
> >   </project>
> >   <project>
> >     <measure name="economy_estimate">44123123</measure>
> >     <measure name="economy_actual">77123123</measure>
> >     <measure name="responsible"> pjc </measure>
> >   </project>
> > </projects>
> >
> >
> > regards
> >   Kasper
> >
> >
> >
> >
> >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
> >
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 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.