xsl-list
[Top] [All Lists]

Re: [xsl] translate to XML using XSL into an HTML table

2007-08-03 13:29:32
Ahhh yes...all to familiar comment memory efficient.
I am a Unix/Perl guy and I am taking an XML online
class offered by O'reilly.

thx
oryan
--- Steve <subsume(_at_)gmail(_dot_)com> wrote:

Looks good. =)

This is the part where I chastise you for using the
memory inefficient
//LISTING/* instead of /PHONEBOOK/LISTING/MEMBER

-Steve

PS: welcome to xsl

On 8/3/07, oryann9 <oryann9(_at_)yahoo(_dot_)com> wrote:

--- Steve <subsume(_at_)gmail(_dot_)com> wrote:
There's a solution to fill in //LAST and //PHONE
with their
corresponding //FIRSTs but I'm hard pressed to
produce it now, given
that your XML <listing /> doesn't encapsulate 1
member but several. If
you have control over the XML I'd wrap <member
/>
around each FIRST,
LAST, PHONE pair.

Perhaps someone else will chime in.


Got it by adding a MEMBER ELEMENT:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="html"/>
<xsl:template match="/">
<html>
    <head>
         <title> My Phone Book</title>
    </head>
     <h2> My Phone Book </h2>
    <body bgcolor="YELLOW">
        <table border="3">
           <tr bgcolor="lightblue">
               <th>FirstName</th>
               <th>LastName</th>
               <th>Phone</th>
           </tr>
            <xsl:for-each select="//LISTING/*">
            <tr>
                <td><xsl:value-of
select="FIRST"/></td>
                <td><xsl:value-of
select="LAST"/></td>
                <td><xsl:value-of
select="PHONE"/></td>
             </tr>
            </xsl:for-each>


        </table>
    </body>
</html>
</xsl:template>
</xsl:stylesheet>






____________________________________________________________________________________
Be a better Globetrotter. Get better travel
answers from someone who knows. Yahoo! Answers -
Check it out.


http://answers.yahoo.com/dir/?link=list&sid=396545469



--~------------------------------------------------------------------
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>
--~--




--~------------------------------------------------------------------
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>
--~--





       
____________________________________________________________________________________
Be a better Globetrotter. Get better travel answers from someone who knows. 
Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545469

--~------------------------------------------------------------------
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>
--~--