[xsl] Help with mode

Subject: [xsl] Help with mode
From: "Meenakshi Nanjundeswar" <meenananju@xxxxxxxxxxx>
Date: Thu, 19 Oct 2006 15:41:47 -0500
Hi:

I can best explain my problem with an example.

XML file:

<step1>
  <note>
     <para>Some text</para>
   </note>
<text><para>Txt</para></text>
<note><para>Second note</para></note>
<step2>
   <note>
      <para>Some other text</para>
   </note>
<text>para>Txt2</para></text>
</step2>
</step1>

Now, step 1 is an element which is formatted with numbering 1. step 2 is formatted with numbering A. There can be 7 levels of steps like this.
The issue I am facing is when I have a note element directly as a child of step1 , step2 ....step7, The number and the NOTE overlap like.
So instead of:


NOTE: Some text
1.Txt
  NOTE:Second note
NOTE:Some Other text
2.Txt2

the number 1. and N of NOTE overlap. To overcome this, under template for step1,step2..step7 I checked said:

<xsl:template match="step1">
<xsl:if test="child::note><xsl:apply-templates select="note" mode="step1"/>
<code for....formatting for step1...>
</xsl:template>

<xsl:template match="step2">
<xsl:if test="child::note><xsl:apply-templates select="note" mode="step1"/>
<code for....formatting for step1...>
</xsl:template>

Under the template for "note",
<xsl:template match="note">
<xsl:choose>
<xsl:when test="parent:step1|step2|step3"></xsl:when>
<xsl:otherwise><!-- formatting for note element--></xsl:otherwise>
</xsl:choose>
</xsl:template>

So, if the parent element is step1 , step 2,...step7 then dont do anything, otherwise format it.

This code is not working for step 2 onwards. the number and letter 'N' of note are overlapping.

What is wrong with this code?
Thank you for your help.

_________________________________________________________________
Get FREE company branded e-mail accounts and business Web site from Microsoft Office Live http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/


Current Thread