newbie question...

newbie question...

Post by Gabriel_ » Fri, 04 Jul 2003 22:29:19



I have:

<xsl:if test="position() mod 2 == 0">

<tr>

and here I want to insert a lot of code

</tr>

</xsl:if>

<xsl:otherwise>and here i want to insert the same code as
above</xsl:otherwise>

Is there any way I can reference that code snippet so i don't have to write
it two times?

/Gabriel

 
 
 

newbie question...

Post by Colin Mackenzi » Fri, 04 Jul 2003 22:33:30


<xsl:when test="position() mod 2 == 0">
    <tr>
        <xsl:call-template name="DoStuff"/>
    </tr>
</xsl:when
  <xsl:otherwise>
        <xsl:call-template name="DoStuff"/>

.....

</xsl:template>

<xsl:template name="DoStuff">
    stuff.....

Colin


Quote:> I have:

> <xsl:if test="position() mod 2 == 0">

> <tr>

> and here I want to insert a lot of code

> </tr>

> </xsl:if>

> <xsl:otherwise>and here i want to insert the same code as
> above</xsl:otherwise>

> Is there any way I can reference that code snippet so i don't have to
write
> it two times?

> /Gabriel


 
 
 

newbie question...

Post by Gabriel_ » Fri, 04 Jul 2003 22:33:02


Alrigth ignore that otherwise element... I guess I just want the same code
in the end, not withing an otherwise element :)



Quote:> I have:

> <xsl:if test="position() mod 2 == 0">

> <tr>

> and here I want to insert a lot of code

> </tr>

> </xsl:if>

> <xsl:otherwise>and here i want to insert the same code as
> above</xsl:otherwise>

> Is there any way I can reference that code snippet so i don't have to
write
> it two times?

> /Gabriel

 
 
 

newbie question...

Post by Gabriel_ » Fri, 04 Jul 2003 22:37:14


Ah yes, thank you :)

/Gabriel



> <xsl:when test="position() mod 2 == 0">
>     <tr>
>         <xsl:call-template name="DoStuff"/>
>     </tr>
> </xsl:when
>   <xsl:otherwise>
>         <xsl:call-template name="DoStuff"/>

> .....

> </xsl:template>

> <xsl:template name="DoStuff">
>     stuff.....

> Colin



> > I have:

> > <xsl:if test="position() mod 2 == 0">

> > <tr>

> > and here I want to insert a lot of code

> > </tr>

> > </xsl:if>

> > <xsl:otherwise>and here i want to insert the same code as
> > above</xsl:otherwise>

> > Is there any way I can reference that code snippet so i don't have to
> write
> > it two times?

> > /Gabriel