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

Re: Expression Logic Problem

Subject: Re: Expression Logic Problem
From: "Charles Knell" <cknell@xxxxxxxxxx>
Date: Wed, 31 Jul 2002 17:49:11 -0700
explorer expression child
While I can appreciate esthetics, the two things I am most concerned
with are correctness and efficiency. My XPath says find a field element
which is a child of a record element, then get the first field element
which is a child of the record element (at least that's what I think
it says, and that appears to be backed up by XPath Explorer.) That is
the most direct way I can see to get the desired element.

If it is incorrect and you or anyone else cares to explain why, I will
be anxious to learn.

Now as to the efficiency, I have no feelings. I suspect that the initial
double-slash could slow things down on a large document, and I can see
that replacing it with an absolute path the the document root might be
better, but I was hoping for a more practical reaction than one concerning
its comeliness.

-- 
Charles Knell
cknell@xxxxxxxxxx - email


---- "Robert S. Koberg" <rob@xxxxxxxxxx> wrote:
> hi,
> 
> Charles Knell wrote:
> > Let me recommend Purple Technology's XPath Explorer (http://sourceforge.net/projects/xpe/)
> > 
> > I copied your XML to a file, opened it in XPath Explorer, and determined
> > this XPath in a few seconds.:
> >   //record/field/../field[1]
> > 
> > or in expanded form:
> >   /descendant-or-self::node()/child::record/child::field/parent::node()/child::field[1.0]
> 
> this looks hideous
> 
> 
> > 
> > This may not be the most efficient XPath, but it is a good starting
> point.
> > 
> > 
> 
> I just noticed a cut & paste error in my code. I had:
> 
> <xsl:if test="not(@id=preceding-sibling::field[1]/@id)">
>  >
>  > <!-- perhaps use a key here? -->
>  >        <xsl:value-of
>  >           select="$/document/configure/server/resultfield[@id=$id]"/>
>  >        <xsl:text>: </xsl:text>
>  >     </xsl:if>
> 
> I was going to use a variable to save line space, but then switched
> back 
> but did not get the '$.' It is probably obvious but it should be:
> 
> <xsl:if test="not(@id=preceding-sibling::field[1]/@id)">
>  >
>  > <!-- perhaps use a key here? -->
> 
>          <xsl:value-of
>           select="/document/configure/server/resultfield[@id=$id]"/>
> 
>  >        <xsl:text>: </xsl:text>
>  >     </xsl:if>
> 
> -Rob
> 
> 
> 
> 
>  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.