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

Newbie - simple selection problem

Subject: Newbie - simple selection problem
From: JWALLIS@xxxxxxxxxxxxxxx
Date: Fri, 30 Nov 2001 11:26:40 -0600
simple table selection
Hello all,
     Even though I'm new, this should be easy as slicing a Thanksgiving
pumpkin pie but XSLT concepts are just not getting through the firewall in
front of my brain.
     The real problem here is concepts. I've been through two tutorials
(CNET and ZVON) neither one is very good. They really don't explain the
selection process very well. If anyone can recommend a good beginners book,
I certainly need it. My company has 500 employees and no one ( I'll will
be/may be it ) does XSLT so I do not have any local resources to "walk
over" to and clear up concepts/details. So sorry for the elementary
questions.
Here's is what I'm shooting for:
Table of information when the data_status is = OK ( table with the
detailed_bbb1, bbb2, ddd1 etc..) and a similar table with all the ERROR
information in another table.

XML doc:
<?xml version="1.0" ?>
<DocRoot>
     <AAA>
          <BBB>
               <detailed_bbb1>abc</detailed_bbb1>
               <detailed_bbb2>def</detailed_bbb2>
               <CCC>
                    <data_status>OK</data_status>
               </CCC>
          </BBB>
          <DDD>
             <detailed_ddd1>abc</detailed_ddd1>
             <detailed_ddd2>def</detailed_ddd2>
          </DDD>
     </AAA>
     <AAA>
          <BBB>
               <detailed_bbb1>abc</detailed_bbb1>
               <detailed_bbb2>def</detailed_bbb2>
               <CCC>
                    <data_status>OK</data_status>
               </CCC>
          </BBB>
          <DDD>
             <detailed_ddd1>abc</detailed_ddd1>
             <detailed_ddd2>def</detailed_ddd2>
          </DDD>
     </AAA>
     <AAA>
          <BBB>
               <detailed_bbb1>abc</detailed_bbb1>
               <detailed_bbb2>def</detailed_bbb2>
               <CCC>
                    <data_status>ERROR</data_status>
               </CCC>
          </BBB>
          <DDD>
             <detailed_ddd1>abc</detailed_ddd1>
             <detailed_ddd2>def</detailed_ddd2>
          </DDD>
     </AAA>
     <AAA>
          <BBB>
               <detailed_bbb1>abc</detailed_bbb1>
               <detailed_bbb2>def</detailed_bbb2>
               <CCC>
                    <data_status>ERROR</data_status>
               </CCC>
          </BBB>
          <DDD>
             <detailed_ddd1>abc</detailed_ddd1>
             <detailed_ddd2>def</detailed_ddd2>
          </DDD>
     </AAA>
</DocRoot>

The ( all wrong ) sheet.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl
="http://www.w3.org/1999/XSL/Transform">

 <xsl:template match="/">
   <HTML>
      <HEAD>
         <TITLE>Results</TITLE>
      </HEAD>
      <BODY>
      <xsl:apply-templates />                            run through all
the children.
        </BODY>
     </HTML>
 </xsl:template>

 <xsl:template match="AAA/BBB/CCC[data_status = 'OK']">      selects all
nodes with OK?
      <TABLE>
         <TR>
            <TD>
               <B>Table start stuff</B>
            </TD>
         </TR>
         <xsl:for-each select ="AAA">                           selects
entire structure with OK?
            <TR>
               <TD><xsl:value-of select="BBB/detailed_bbb1"/></TD>
get the values and place in a table
               <TD><xsl:value-of select="BBB/detailed_bbb2"/></TD>
               <TD><xsl:value-of select="DDD/detailed_ddd1"/></TD>
            </TR>
         </xsl:for-each>
        </TABLE>
 </xsl:template>

</xsl:stylesheet>

I won't bother to list the garbage out because, obviously, I have garbage
in.
I know these forums hate to answer questions that are really too easy but
I'm stuck. So if anyone answers such an easy question, thanks.
This shouldn't be this difficult this time of the year... there is holiday
shopping to do.
jim


 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.