xsl-list
[Top] [All Lists]

RE: Some help with xsl transform and filter please

2004-03-25 11:33:43
Your path is incomplete. 

<xsl:template match="/">
        <xsl:for-each select="struct/member/value[string='Syndicated']">

Your template match is putting your context at the root of the document so your 
for-each is looking for a "struct" node relative to the root, but there isn't 
one.

You can fully specify the path like this:
<xsl:for-each 
select="methodResponse/params/param/value/array/data/value/struct/member/value[string='Syndicated']">

This explicitly tells the xpath processor where to find the nodes.

Josh

-----Original Message-----
From: Dylan Barber [mailto:dylan(_dot_)barber(_at_)earthlink(_dot_)net]
Sent: Thursday, March 25, 2004 9:33 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Some help with xsl transform and filter please


Okay hope I am not asking something so basic everyone thinks I am a dunce but i 
have an xml document that comes from a web service like this

  <?xml version="1.0" encoding="iso-8859-1" ?> 
           <methodResponse>
                <params>
                       <param>
                            <value>
                                <array>
                                    <data>
                                         <value>
                                              <struct>
                                                 <member>
                                                      <name>feedid</name> 
                                                      <value>
                                                             
<string>2403</string> 
                                                      </value>
                                                 </member>
                                                 <member>
                                                      <name>status</name> 
                                                      <value>
                                                            
<string>Syndicated</string> 
                                                      </value>
                                                 </member>
                                              </struct>
                                        </value>
                                  </data>
                             </array>
                       </value>
                 </param>
            </params>
  </methodResponse>

I have tried to transform it with something like this 

<xsl:template match="/">
        <xsl:for-each select="struct/member/value[string='Syndicated']">
                <xsl:value-of select="name" />
                :
                <xsl:value-of select="string" />
                ;<br />
                </xsl:for-each>
        </xsl:for-each>
</xsl:template>

but this doesnt seem to work.  I am a newbie with this whole thing and really 
need some guidance on how this whole xsl xml thing goes together.  Sorry if I 
have missed the obvious or broken any rules.

Dylan Barber (CIW Professional, A+ Technician, Web Designer, Web Developer)

home phone-:- (785) 765-2664
work phone-:- (785) 539-3565 x1034
email-:- dylan(_dot_)barber(_at_)earthlink(_dot_)net
homesite-:- http://www.codegalaxy.com


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
You are subscribed as: Josh(_dot_)Canfield(_at_)plumtree(_dot_)com
To unsubscribe, go to: 
http://lists.mulberrytech.com/unsub.php/xsl-list/Josh(_dot_)Canfield(_at_)plumtree(_dot_)com
or e-mail: 
<mailto:xsl-list-unsubscribe-Josh(_dot_)Canfield=plumtree(_dot_)com(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--