xsl-list
[Top] [All Lists]

RE: Dynamical work with child nodes

2004-04-07 01:30:18
Thanks a lot. That was exactly what I wanted (and it works, too).

-----Original Message-----
From: Mukul Gandhi [mailto:mukulgandhi2003(_at_)yahoo(_dot_)co(_dot_)in]
Sent: Dienstag, 6. April 2004 17:49
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Dynamical work with child nodes


Hi Roland,
  Something like the following might be ok. The
structure just illustrates the concept.

<xsl:template match="/">
   <xsl:for-each select="root/rowset/row">
     <xsl:for-each select="*">
        <xsl:value-of select="name(.)" /> -
<xsl:value-of select="." />
     </xsl:for-each>
   </xsl:for-each>
</xsl:template>

Regards,
Mukul

 --- Roland Juergens <roland_juergens(_at_)icon-scm(_dot_)com>
wrote: > Hi,

I have an XML file like this which contains results
from a database query.
Is there a way to go dynamically through the
subelements of my "row"
elements, because I want to use it for different
queries.
So the subelements like "id" or "name" might change.

<root>
      <rowset>
              <row>
                      <id>1</id>
                      <name>bla</name>
              </row>
              <row>
                      <id>2</id>
                      <name>blabla</name>
              </row>

              ...(more <row> elements)...

      </rowset>
</root>


This is how the xsl-file looks like now

...
<xsl:for-each select="root/rowset/row">
...
      <xsl:value-of select="id"/>
...
      <xsl:value-of select="name"/>
...
</xsl:for-each>
...



What I imagine is the following :
I want to get the number of subelements of a "row"
element, then iterate
over it to get the names, and then building it
dynamical.
Is something like that possible ?


Roland Juergens




--+------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--
 

________________________________________________________________________
Yahoo! India Insurance Special: Be informed on the best policies, services,
tools and more. 
Go to: http://in.insurance.yahoo.com/licspecial/index.html

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--


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