[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] step-by-step work instructions -- recursive apply-templ ates to cr eate html table


Subject: RE: [xsl] step-by-step work instructions -- recursive apply-templ ates to cr eate html table
From: "Kathy Burke" <Kathy_Burke@xxxxxxxxx>
Date: Wed, 9 Apr 2003 14:39:55 -0400

Americo,

This is really nice...once I figure out how to get the text in the steps and
include the other para subelements...

For my learning purposes...would you mind explaining what these two lines
do?

   <xsl:variable name="space" select="(count(ancestor::step) * 13 + 1) *
7"/>

   <xsl:if test="not(ancestor::step)">

Thanks again.

Kathy

-----Original Message-----
From: Américo Albuquerque [mailto:aalbuquerque@xxxxxxxxxxxxxxxx]
Sent: Wednesday, April 09, 2003 1:36 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] step-by-step work instructions -- recursive
apply-templates to cr eate html table


Hi.

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Kathy Burke
> Sent: Wednesday, April 09, 2003 5:03 PM
> To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: [xsl] step-by-step work instructions -- recursive 
> apply-templates to cr eate html table
> 
> 
> I've been asking for help with this on dev forum so please 
> forgive me if this is a cross-post. No one seems to want to 
> help me on this one...? I've tried looking at doc book for 
> examples, but SO complicated I can't figure it out. I've also 
> read this FAQ and other posts ...very enlightening but my XML 
> "light" hasn't quite gone on yet!
> 
> I'm trying to create a table for work instructions: up to 5 
> nested <step> elements with sub elements sometimes included 
> (measure, href, etc.) I've tried combinations of 
> choose/when/if etc. but either I get the numbering correct 
> (which needs to be outline format 1., 1.1, 1.1.1, 1.1.1.1, or
> 1.1.1.1.1) or it also numbers the multiple para's within a 

You can do this with <xsl:number level="multiple" count="step"
format="1.1"/>


You could try this and change it to your needs:

 <xsl:template match="process_steps">
 <table border="0">
  <xsl:apply-templates/>
 </table>
 </xsl:template>
 
 <xsl:template match="step">
  <xsl:variable name="space" select="(count(ancestor::step) * 13 + 1) * 7"/>
  <tr>
   <td width="140" valign="top">
    <xsl:apply-templates select="@ckbox[.='yes']"/>
   </td>
   <td valign="top">
    <table width="100%" border="0">
     <tr>
      <td valign="top" width="{$space}">
       <table border="0">
        <tr>
         <td width="{$space}">&#160;</td>
         <td>
         <xsl:number level="multiple" count="step" format="1.1"/>
         <xsl:if test="not(ancestor::step)"><xsl:text>.</xsl:text></xsl:if>
         <xsl:text>&#9;</xsl:text>
        </td>
       </tr>
      </table>
      </td>
      <td>
       <xsl:apply-templates select="*[not(self::step)]"/>
      </td>
     </tr>
    </table>
   </td>
  </tr>
  <xsl:apply-templates select="step"/>
 </xsl:template>
 
 <xsl:template match="@ckbox">
  <input type="checkbox">
   <xsl:if test=".='yes'"><xsl:attribute
name="checked">checked</xsl:attribute></xsl:if>
  </input>
 </xsl:template>
 
 <xsl:template match="para">
  <p>
   <xsl:apply-templates/>
  </p>
 </xsl:template>
 
 <xsl:template match="measure">
  <!-- you could also use a textarea instead -->
  <input type="text" value="{.}"/>
 </xsl:template>





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords
xml