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

Re: Trouble creating a table with multiple named temp

Subject: Re: Trouble creating a table with multiple named templates
From: Max Bronsema <max.bronsema@xxxxxxxxx>
Date: Tue, 3 May 2005 10:23:16 -0600
max temp for office working
Hi again Jay,

I hope I am not keeping you from doing your real consulting work :),
thank you for the code below. It works as you said it would. I had
butchered some XSL to get that same result before but ran into the
problem of it not going through the entire XML tree. The same thing is
happening here except your code is much much better. I am able to have
it work through the tree when I just list an element by it's name and
do not use XPATH.

Example
<td><xsl:value-of select="fName"/></td>

Alas, that only works if I use an XPATH location in the match portion
of the template tag.

Example
<template match="directory/staffOffice/Office">

Then it will iterate through the entire tree for that portion. Is this
caused by having the extra node staffOffice? What is the next step I
should try?
Oh, and Boone as I am refering to it is a building at the location of
where I work.

Thanks again,

Max


> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="2.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
>   <xsl:template match="directory">
>     <table>
>       <tr>
>         <td><xsl:value-of select="staffOffice/Office/dptFull"/></td>
>       </tr>
>       <tr>
>         <td><xsl:value-of select="staffOffice/Office/Location"/></td>
>         <td><xsl:value-of select="staffTitle/Position/phone"/></td>
>         <!-- No fax or box in the sample, so skipped -->
>       </tr>
>       <tr>
>         <td>
>           <xsl:value-of
> select="normalize-space(staffPersonal/Person/lName)"/>
>           <xsl:text>, </xsl:text>
>           <xsl:value-of
> select="normalize-space(staffPersonal/Person/fName)"/>
>         </td>
>         <td><xsl:value-of select="staffTitle/Position/phone"/></td>
>         <td><xsl:value-of select="staffTitle/Position/pEmail"/></td>
>         <!-- No title in sample, so skipped -->
>         <td><xsl:value-of select="staffOffice/Office/Location"/></td>
>       </tr>
>     </table>
>   </xsl:template>
>
> </xsl:stylesheet>
>
> Produces this HTML fragment:
>
> <table>
>   <tr>
>     <td>Biology</td>
>   </tr>
>   <tr>
>     <td>Boone</td>
>     <td>xxx-xxxx</td>
>   </tr>
>   <tr>
>     <td>last Name, first Name</td>
>     <td>xxx-xxxx</td>
>     <td>xyxy@xxxxxxxx</td>
>     <td>Boone</td>
>   </tr>
> </table>
>
> I used the normalize-space function to remove the trailing spaces on the
> names. Otherwise, I got a space before the comma.
>
> I'm sure your data is more complex, but I hope this small stylesheet gives
> you one idea for how to approach your problem. Other solutions exist.
>
> If you run into trouble, let us know.
>
> (That wouldn't be Boone, IA, would it?)
>
> Jay Bryant
> Bryant Communication Services
> (presently consulting at Synergistic Solution Technologies)

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.