Subject: Reading every element from the specified node
Posted By: ROCXY Post Date: 1/3/2006 8:18:27 AM
hai,
I have the XML like this:
<root>
  <artfront>
     <rauthor>
     <rtitle>
  </artfront>
  <art>
  <head>
  <artbody>
      <section>              
        ......
        ......
         <subsection>
           .............
           .............
              <subsection>
                .......
                <qanda>
                  <quest>...........</quest>
                  <answer>...........</answer>
                  <quest>...........</quest>
                  <answer>...........</answer>
                </qanda>
        <artback>
          .........
          .........
        </artback>
</root>


here is our XSL:
  <xsl:template match="artbody">
  <xsl:for-each select="//*">
  <xsl:message><xsl:value-of select="name()"/></xsl:message>
  </xsl:for-each>
  </xsl:template>

It is reading from the root.but i want to read the elements from the artbody.
 i tried like this also
 <xsl:template match="artbody">
  <xsl:for-each select="artbody/*">
  <xsl:message><xsl:value-of select="name()"/></xsl:message>
  </xsl:for-each>
  </xsl:template>
but it is not work.

please give the solution
             Thank you







Reply By: mhkay Reply Date: 1/3/2006 8:25:14 AM
//* selects all elements in the document

.//* selects all elements that are descendants of the current element. Alternatively, use descendant::*.



Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

Go to topic 38199

Return to index page 737
Return to index page 736
Return to index page 735
Return to index page 734
Return to index page 733
Return to index page 732
Return to index page 731
Return to index page 730
Return to index page 729
Return to index page 728