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

RE: CALS and keys (difficult)

Subject: RE: CALS and keys (difficult)
From: "McNally, David" <David.McNally@xxxxxxxxxx>
Date: Tue, 5 Feb 2002 13:42:51 -0500
colname xsl
I had to do something quite similar to this - here's some code:

<xsl:template match="entry">
<th>
<xsl:if test="@spanname">
	<xsl:variable name="namest"
select="ancestor::tgroup/spanspec[@spanname=current()/@spanname]/@namest"/>
	<xsl:variable name="nameend"
select="ancestor::tgroup/spanspec[@spanname=current()/@spanname]/@nameend"/>
	<xsl:variable name="colst"
select="ancestor::*[colspec/@colname=$namest]/colspec[@colname=$namest]/@col
num"/>
	<xsl:variable name="colend"
select="ancestor::*[colspec/@colname=$nameend]/colspec[@colname=$nameend]/@c
olnum"/>
	<xsl:attribute name="colspan"><xsl:value-of select="number($colend)
- number($colst) + 1"/></xsl:attribute>
</xsl:if> 
</th>
</xsl:template>

which I think is okay and correctly identifies the right colspecs for theads
and tbodys.  I don't know if it's very efficient, though, and it won't work
for entrytbl's with spanspecs.

Hope this helps,
David.
--
David McNally            Moody's Investors Service
Software Engineer        99 Church St, NY NY 10007 
David.McNally@xxxxxxxxxx            (212) 553-7475 




> From: Andrew Welch [mailto:andrew@xxxxxxxxxxxxxxxxxxxxxxx]
> So, I need this psuedocode converted to xsl (I think using keys):
> 
> match <entry>
> if it has attribute spanname
>   find ancestor <spanspec> with same spanname attribute
>     get namest attribute
>     get nameend attribute
>   work out number of columns from colspec, based on colname attributes
>   output 'colspan=' the value
> 
> 
> ===The XML snippet===
> <tgroup cols="4">
>   <colspec colname="C.9P2" colnum="1" colwidth="55mm"/>
>   <colspec colname="C.9PC" colnum="2" colwidth="32mm" align="CENTER"/>
>   <colspec colname="C.9PE" colnum="3" colwidth="32mm" align="CENTER"/>
>   <colspec colname="C.9PG" colnum="4" colwidth="49mm"/>
>   <spanspec spanname="S.9PA" namest="C.9PB" nameend="C.9PD"/>
>   <thead valign="MIDDLE">
>      <colspec colname="C.9PH" colnum="1" colwidth="55mm"/>
>      <colspec colname="C.9PB" colnum="2" colwidth="32mm" 
> align="CENTER"/>
>      <colspec colname="C.9PD" colnum="3" colwidth="32mm" 
> align="CENTER"/>
>      <colspec colname="C.9PF" colnum="4" colwidth="49mm"/>
>      <row rowsep="1">
>         <entry colname="C.9PH" morerows="1" valign="MIDDLE"
> align="CENTER">Item</entry>
>         <entry spanname="S.9PA" rowsep="1" 
> align="CENTER">Location</entry>
>         <entry colname="C.9PF" morerows="1" valign="MIDDLE"
> align="CENTER">Access</entry>
>      </row>
>      <row rowsep="1">
>         <entry colname="C.9PB" align="CENTER">Zone</entry>
>         <entry colname="C.9PD" align="CENTER">Compartment</entry>
>      </row>
>   </thead>
> 
> ===The Required HTML===
> <tr>
>   <th rowspan="2" align="CENTER" valign="MIDDLE">Item</th>
>   <th colspan="2" align="CENTER">Location</th>
> <th rowspan="2" align="CENTER" valign="MIDDLE">Access</th>
> </tr>
> <tr>
>   <th align="CENTER">Zone</th>
>   <th align="CENTER">Compartment</th>
> </tr>
> 

> 


---------------------------------------

The information contained in this e-mail message, and any attachment thereto, is confidential and may not be disclosed without our express permission.  If you are not the intended recipient or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution or copying of this message, or any attachment thereto, in whole or in part, is strictly prohibited.  If you have received this message in error, please immediately notify us by telephone, fax or e-mail and delete the message and all of its attachments.  Thank you.

Every effort is made to keep our network free from viruses.  You should, however, review this e-mail message, as well as any attachment thereto, for viruses.  We take no responsibility and have no liability for any computer virus which may be transferred via this e-mail message.

 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.