[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xml and xslt to html attribute problems

Subject: RE: xml and xslt to html attribute problems
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Wed, 29 Oct 2003 10:39:43 -0500
xslt html attribute
[ Michael Olszynski]

> Hello, I want to use sth. like
> 
>     <topic name="Mygreatlongword<br>onabeautifulmorning">
> 
>  with following xslt code
> 
> <td>    <xsl:value-of select="@name"/>
> </td>
> 
> to get this html code
> 
> <td>
>     Mygreatlongword
>     <br>
>     onabeautifulmorning
> </td>
> 

I see that no one else has recommended outright that you change the
source so that the text content is not in an attribute but in element
content.  That is what you should be doing if it is at all possible.  If
it is not possible, you have another problem because your example is not
well-formed XML at all (no elements are allowed in the value of an
attribute).

I would make my xml source something like this -

<topic><name>Mygreatlongword<br/>onabeautifulmorning</name>....</topic>

Of course, with this approach you would not really need to put a <br/>
in at all, just an ordinary line break. 

On the other hand,  it would seem that there is some meaning to the
break between the left and right sides of your content, as if "My
greatlongword" is the name and "onabeautifulmorning" is the value.  If
this is correct, you would do better if your xml source reflected the
distinction in the first place.  this would be another reason for
looking to redesign the xml design.  Once the design reflects the
structure of your data, it will be much easier to get a stylsheet to do
things you want to do.

Cheers,

Tom P

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.