Altova Mailing List Archives


[xsl] Achieving a nesting rule...?

From: "Clifford, Karen" <Karen.Clifford@------------>
To:
Date: 1/13/2003 5:06:00 AM
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

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.