xsl-list
[Top] [All Lists]

Achieving a nesting rule...?

2003-01-13 08:00:56
Hi there, 

Im hoping someone out there can provide me with some insight into the
following...

I have an xml doc resembling something like......

<list ordinal="Process">
                                <listitem>
                                        <para>Some Paragraph</para>
                                        <list>
                                                <listitem>
                                                        <list>
                                                                <listitem>
        
<para>some paragraph</para>
        
<table>
        
<tgroup>
        
<tbody>
        
<row>
        
<entry>
        
<para> table in list</para>
        
</entry>
        
<entry>
        
<para>table in list</para>
        
</entry>
        
</row>
        
<row>
        
<entry>
        
<para>table in list</para>
        
</entry>
        
<entry>
        
<para>table in list</para>
        
</entry>
        
</row>
        
</tbody>
        
</tgroup>
        
</table>
                                                                </listitem>
                                                        </list>
                                                </listitem>
                                        </list>
                                </listitem>
                                <listitem>
                                        <para>two process</para>
                                </listitem>
                        </list>


For each table, (from matching <tgroup>) I must assess the level of nesting
within the list and then assign a table width appropriately......eg
Example 1.

<list>
   <listitem>
        <table>
             <tgroup>
This is 1st level nesting of the table and I wish the width to be 90%, my
xsl for that is similar to.....

        <xsl:when test="name(../../..)='list' or
name(../../..)='orderedList'">
                <xsl:attribute name="width">
                <xsl:text>90%</xsl:text>
                </xsl:attribute>
        </xsl:when>                                             

Example 2.

<list>
   <listitem>
      <list>
         <listitem>
             <table>
               <tgroup>
This is 2nd level nesting of the table and I wish the width to be 85%, my
xsl for that is similar to.....

        <xsl:when test="name(../../../../..)='list' or
name(../../../../..)='orderedList'">
                <xsl:attribute name="width">
                <xsl:text>85%</xsl:text>
                </xsl:attribute>
        </xsl:when>     

Ive carried on above onto the 3rd level of nesting (80%) but realise that
this isnt the best way as I am not catering for any deeper levels (4th
onwards).....is there a shortcut I can use to achieve this?     

You could say .... count each list/listItem pair and thats the level of
nesting required (1st, 2nd etc...)........?             


Kind Regards

Karen




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



<Prev in Thread] Current Thread [Next in Thread>