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

Re: XPath selection using //

Subject: Re: XPath selection using //
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Wed, 17 Jul 2002 15:07:12 +0000
xpath find atribute
Hi Filipe,

The XML you given is not wellformed...
and if you want to evaluate only m elements you can write a template that matches the m element
<xsl:template match="m">
and if you want to find the next m element's a attribute,you shud use
following::m/@a..
your following-sibling wont work because the next 'm' is not actually a sibling of the first 'm'.


i reckon you go through Mike Kay's XSLT Reference to understand how axis works.
hope this helps
Vasu



From: "Filipe Correia" <filipe.correia@xxxxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  XPath selection using //
Date: Wed, 17 Jul 2002 15:11:06 +0100


Hi,


Here's a tree wich is a part of my xml document:

<b>
  <m a="attribute">
    text text text
    <t>
      <r>
        <d>more text</d>
      <r/>
    </t>
  </m>
  <t>
    <r>
      <d/>
      <d><m a="attribute">text</m></d>
    <r/>
  </t>
  <m/>
  text
</b>

what I want to do is to evaluate only the
contents of the "m" elements. For each "m"
element I also need to output the next "m"'s
"a" atribute.
Everything else should be ignored.

In the stylesheet that I use I'm applying the
respective templates like this:

...

<xsl:apply-templates select="b//m"/>

...

 using the following template to apply
 templates to all descendants of the
 current "m" node and to get the next "m"'s
 "a" atribute:

<xsl:template match="m">
<xsl:apply-templates/>
Atribute a of the following m is:
<xsl:value-of select="ancestor::*[parent::b]/following-sibling::node()//m/@a"/>
</xsl:template>


 but getting the next "m"'s "a" atribute is
 not working as I expected...

Any idea on what I may be doing wrong?


Thanks in advance,


Filipe


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




_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx



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.