This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: matching multiple times, outputting once?



> try adding these templates
> 
> <xsl:template match="*[@bold='Yes' ]">
> </xsl:template>
> 
> <xsl:template match="*[@bold='Yes' and @italic='Yes' ]">
> </xsl:template>
> 
> <xsl:template match="*[@bold='Yes' and @italic='Yes' and
> @underline='Yes' ]">
> </xsl:template>

while this will work for the mentioned cases, it will not work for all
    the combinationes there of: b, i, u, bi, bu, iu, ibu.

what about this:

<xsl:template match="emphasis">
  <xsl:call-template name="emphasis_b" />
</xsl:template>  

<xsl:template name="emphasis_b">
  <xsl:choose>
    <xsl:when test="@bold='Yes'">
      <b><xsl:call-template name="emphasis_i"/></b>
    </xsl:when>
    <xsl:otherwise>
      <xsl:call-template name="emphasis_i"/>
    <xsl:otherwise>
  </xsl:choose>  
<xsl:template>  
    
<xsl:template name="emphasis_i">
  <xsl:choose>
    <xsl:when test="@italic='Yes'">
      <i><xsl:call-template name="emphasis_u"/></i>
    </xsl:when>
    <xsl:otherwise>
      <xsl:call-template name="emphasis_u"/>
    <xsl:otherwise>
  </xsl:choose>  
<xsl:template>  

<xsl:template name="emphasis_u">
  <xsl:choose>
    <xsl:when test="@underline='Yes'">
      <i><xsl:value-of select="."/></i>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="."/>
    <xsl:otherwise>
  </xsl:choose>  
<xsl:template>  


-- 
Goetz Bock                                              IT Consultant
Dipl.-Inf. Univ.

PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]