Skip to Content
avatar image
Former Member

XSLT Preceding sibling issue

I've the input xml where i ve tables and notes tags. I need to display the notes which is coming between the tables tags just like that . notes can also come in different places. I've used apply templates of note before table , so its applying all the notes before table itself .I need to display the nodes tag if its coming in between the tables just like that.

INPUT:

<step>
<note>..</note>

<para>..</para>

<table>
 ..
 ..
 </table><note>...</note><table>
   ..
   ..
 </table><table>
   ..
   ..
 </table><note>...</note><text>...</text></step>
desired OUPUT:
<fc:topic>
  <fc:subTask id="S0EC0A941" lbl="E.">
  <fc:para>..</fc:para>
  <fc:text>...</fc:text>
  <fc:note>..</fc:note>
  <fc:table>
   ..
   ..
  </fc:table>
  <fc:note>...</fc:note>
  <fc:table>
   ..
   ..
   </fc:table>
   <fc:table>
   ..
   ..
  </fc:table>
  <fc:note>...</fc:note>
  </fc:subTask>
 </fc:topic>

Current XSLT which needs to modify for the desired output 
<xsl:template match="step">
    <fc:topic>
        <fc:subTask>
            <xsl:if test="@id">
                <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
            </xsl:if>
            <xsl:attribute name="lbl"><xsl:number format="A."/></xsl:attribute>         
            <xsl:apply-templates select="para"/>
            <xsl:apply-templates select="text"/>
            <xsl:apply-templates select="note"/>
            <xsl:apply-templates select="table"/>               
        </fc:subTask>
    </fc:topic>
</xsl:template>
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Mar 12 at 07:06 AM

    Hi Aswini!

    <xsl:apply-templates select="table/note"/>

    Regards, Evgeniy.

    Add comment
    10|10000 characters needed characters exceeded