Subject: Re: [xsl] xsl:apply-template and xsl:for-ech confusion From: Anton Triest <anton@xxxxxxxx> Date: Fri, 01 Oct 2004 14:04:59 +0200 |
<xsl:template match="tblMIM"> <xsl:apply-templates select="tblMIMCompanies"/> </xsl:template>
<xsl:template match="tblMIMCompanies" mode="output"> <xsl:value-of select="@name"/> ... </xsl:template>
Cheers, Anton
Hello guys,
thanks a lot for the great help you gave me with my previous problem, hopefully this will be as simple to solve. I have
<xsl:template match="tblMIM"> <xsl:for-each select="tblMIMCompanies"> <xsl:choose> <xsl:when test="$searchby=0"> <xsl:if test="tblMIMSubSectors[@subsectorID=$subsector]"> <xsl:value-of select="@name"/> ... </xsl:if> </xsl:when> <xsl:when test="$searchby=1"> <xsl:if test="tblMIMSubSectors[@sectorID=$sector]"> <xsl:value-of select="@name"/> ... </xsl:if> </xsl:when> </xsl:choose> </xsl:for-each> </xsl:template>
i would like to change it to something like the code below, which doesn't output anything. This way i don't need to repeat the inner most code since its the same for each. any ideas?
<xsl:template match="tblMIM"> <xsl:for-each select="tblMIMCompanies"> <xsl:choose> <xsl:when test="$searchby=0"> <xsl:if test="tblMIMSubSectors[@subsectorID=$subsector]"> <xsl:apply templates select="tblMIMCompanies"/> </xsl:if> </xsl:when> <xsl:when test="$searchby=1"> <xsl:if test="tblMIMSubSectors[@sectorID=$sector]"> <xsl:apply templates select="tblMIMCompanies"/> </xsl:if> </xsl:when> </xsl:choose> </xsl:for-each> </xsl:template>
<xsl:template match="tblMIMCompanies"> <xsl:value-of select="@name"/> ... </xsl:template>
the xml looks like this
<tblMIM> <tblMIMCompanies name="A Ltd" ...> <tblMIMSubSectors subsectorID="55" sectorID="3"/> </tblMIMCompanies> <tblMIMCompanies name="Z Ltd" ...> <tblMIMSubSectors subsectorID="56" sectorID="3"/> </tblMIMCompanies> </tblMim>
regards Luke Ambrogio
p.s. thanks in advance
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] xsl:apply-template and xs, Michael Kay | Thread | Re: [xsl] xsl:apply-template and xs, Luke Ambrogio |
RE: [xsl] xsl:apply-template and xs, Michael Kay | Date | [xsl] problem with table border, Eldho George |
Month |