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

RE: selecting from multiple different node sets

Subject: RE: selecting from multiple different node sets
From: "Zakon, Stuart" <ZakonS@xxxxxxxxxxxxxx>
Date: Mon, 21 Jun 1999 11:51:01 -0400
circle to square transformation
Steve, 
Thanks much for the response. My comments below.

> -----Original Message-----
> From:	Steve Dahl [SMTP:sdahl@xxxxxxxxxxx]
> Sent:	Friday, June 18, 1999 1:53 PM
> To:	Zakon, Stuart
> Subject:	Re: selecting from multiple different node sets
> 
> Zakon, Stuart wrote:
> 
> > Hi,
> >
> > If I specify a match which looks like this:
> >
> > <xsl:template match="Circle|Square">
> > <xsl:value-of select="name"/>
> > </xsl:template>
> >
> > And then try to select on it, I can do either one of the following and
> it
> > will work.
> > <xsl:apply-templates select='//Circle[@ID=normalize($target)]'/>
> > <xsl:apply-templates select='//Square[@ID=normalize($target)]'/>
> >
> > However what I want to do is say "find me the name of EITHER the Circle
> or
> > the Square
> > that has an attribute 'ID' equal to a specified value. ID is unique but
> I
> > don't
> > know if it is a Circle or a Square.
> > I am new to XSL so while it is probably easy I haven't found the
> solution
> > yet.
> >
> > Thanks,
> > Stuart
> 
> Which XSL are you using? I'll describe several strategies that are
> appropriate
> for XT.
> 
	I am using LotusXSL v0.17.1 which has been quite good so far.

> The following uses a specific test:
> 
	I tried this and it worked! Thanks much. 
	The performance was about 35% slower (15s vs 11s) than just
specifying either Circle or Square alone.
	Nevertheless, it was much better than your second solution below.
	I wonder if there is a faster alternative or if the XSL processor
could be optimized for the qname() expression below.
>     <xsl:apply-templates select="//*
>                     [qname()='Circle' or qname()='Square']
>                     [@ID=normalize($target)]"/>
> 
> The line breaks are added only for clarity, and you can remove them.
> 
> 
> The following uses modes to collect only circles and squares.
> 
	I have been using modes anyways. I need them for the name query
because I also need Circle and Square for another transformation which has
an output.

	However, the big problem with the following SELECT is that it is too
CPU intensive, probably because it is searching every node instead of just
Circle or Square. When I did this it took 10 times as long as when I just
did Circle or Square (100s vs. 11s). It is also probably logarithmic in
performance degradation as the size of the document grows.  What does the
priority="-2" do?
>     <xsl:apply-templates select="//*[@ID=normalize($target)]"
> mode="circle"/>
> 
>     <xsl:template match="Circle|Square" mode="circle">
>     <xsl:value-of select="name"/>
>     </xsl:template>
> 
>     <xsl:template match="*" priority="-2" mode="circle">
>     </xsl:template>
> 
> --
> - Steve Dahl
> sdahl@xxxxxxxxxxx
> 
	Thanks again for your help - much appreciated. 
	Stuart Zakon


 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.