xsl-list
[Top] [All Lists]

RE: xpath question

2003-03-28 08:28:24
Ah! 

Surely you would just use the position of the selected group child node then?

<xsl:key name="groupKey" match="group/*" use="local-name()" />

<xsl:template match="column">
        <xsl:for-each select="key('groupKey', @name)">
                <xsl:value-of 
select="/root/descriptions/description[position()]" />
      </xsl:for-each>
</xsl:template>

-----Original Message-----
From: florian [mailto:csshsh(_at_)structbench(_dot_)com]
Sent: 28 March 2003 14:06
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] xpath question



hi!

A very strange structure if you don't mind me saying!

i know.. its not really clear yet if im able to change it though : /

If you assume that the description nodes are in the same order as the 
equivalent column nodes
(which in your example is not the case!!) :

thats the point. the description nodes are just in the same order as
in the group nodes. since they relate together. the first child node in
a group  node would be an apple for example, so the first child node
in the descriptions node, would have to be the description node for
the apple.



It is not obvious in your example how the description elements relate to the 
column
elements other than the fact they have the same fruit...!?!

A far better structure might be:
<root>
 ..
  <order>
     <column name="orange" description="this is an orange"/>
     <column name="apple"  description="this is an apple"/>
   </order>
 ..
</root>

that would be for sure the most simple solution. the problem is though
that the description nodes and the order nodes are in real-life coming
from two different xml documents. so i would have to kinda pack them
together with xslt first, which would make things also kinda akward. : /


ciao!
florian



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
Visit our website at http://www.rm.com

This message is confidential.  You should not copy it
or disclose its contents to anyone.  You may use and apply the information
only for the intended purpose.  Internet communications are not secure and
therefore RM does not accept legal responsibility for the contents of this
message.  Any views or opinions presented are only those of the author and
not those of RM.  If this email has come to you in error please delete it
and any attachments.  Please note that RM may intercept incoming and
outgoing e-mail communications.

This email has been scanned for viruses by Trend ScanMail.

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



<Prev in Thread] Current Thread [Next in Thread>