xsl-list
[Top] [All Lists]

Re: [xsl] Turning css (font-weight:bold) attributes into tags <b>

2007-03-13 08:05:23
Rick Livesey wrote:

  Hi

Can anyone point me in the right direction?

  Personnally I'd use a recursive template.  Here is an example,
without all details:

    <!-- Map from style tokens to element names -->
    <xsl:variable name="style-mapping" as="element()+">
      <e s="bold">b</e>
      <e s="sup">sup</e>
      ...
    </xsl:variable>

    <xsl:template name="do-style">
      <xsl:param name="style"/>
      <xsl:variable name="next" select="get-next-token($style)"/>
      <xsl:if test="$next">
        <xsl:element name="{ $style-mapping[(_at_)s eq $next] }">
          <xsl:call-template name="do-style">
            <xsl:with-param name="style"
                            select="get-remainder($style)"/>
          </xsl:call-template>
        </xsl:element>
      </xsl:if>
    </xsl:template>

  Regards,

--drkm



















        

        
                
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur 
Yahoo! Questions/Réponses 
http://fr.answers.yahoo.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>