xsl-list
[Top] [All Lists]

RE: need help with converting attribute into elements

2003-10-14 02:05:04
Hi Ales

I expect someone could suggest a prettier and more modular approach but
nested choose blocks would do it:

<xsl:template match="text">
 <p>
  <xsl:choose>
   <xsl:when test="@bold='true'">
    <b>
     <xsl:choose>
      <xsl:when test="@italic='true'">
       <i>
         etc, etc.....
    </b>
   </xsl:when>
   <xsl:otherwise>
  
   </xsl:otherwise> 
  </xsl:choose>
 </p>
</xsl:template>

Cheers

Rod


-----Original Message-----
From: Ale¹ Peregrin [mailto:ales(_dot_)peregrin(_at_)unicorn(_dot_)cz]
Sent: 14 October 2003 09:47
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] need help with converting attribute into elements


Hi!
I'm trying to make a XSLT stylexheet for transforming XML document into HTML
and there is a problem I'm unable to solve, even after a week of trying and
searching all over the internet. The problem looks quite easy to me and it
seems I'm missing something important about XSL  language. Here it goes:

I have an XML tag which looks like this: <text bold=true italic=true
underline=false>Help!</text>
In this case, the result in HTML should be:
<font>
   <b>
      <i>
         Help!
      </i>
   </b>
</font>

I simply need to transform the attributes into HTML elements so that any of
the possible combinations of the atributes' values would be transformed
correctly.

Can anyone help me?
Thanx.
Ales Peregrin


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________


________________________________________________________________
Any opinions expressed in this email are those of the individual and not 
necessarily the Company. Unless expressly stated to the contrary, this email is 
not intended to give rise to a new, or affect an existing, contractual or other 
legal relationship.This email and any files transmitted with it, including 
replies and forwarded copies which may contain alterations) subsequently 
transmitted from the Company, are confidential and solely for the use of the 
intended recipient. The unauthorised use, disclosure or copying of this email, 
or any other information contained or attached,is prohibited and could, in 
certain circumstances, be a criminal offence.

If you have received this email in error please notify the sender as soon as 
possible.

This footnote also confirms that this email message has been swept for the 
presence of computer viruses.

www.focusdiy.co.uk
_________________________________________________________________

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list