xsl-list
[Top] [All Lists]

Re: Re: outputing tags

2003-01-05 10:18:41
On Sun, Jan 05, 2003 at 11:34:09AM -0500, cknell(_at_)onebox(_dot_)com
wrote:
It wasn't clear if you have all the answers you need, but in
case you still need a solution to:

"Ok, then how do I do this:  I have my xml file with all the
info I need in it.  There is one element named <quote> which
contains quotes.  Some quotes need to have line break (
<br>'s in HTML).  How do I denote a line break in the XML
and then how do I transform it?"

the answer is that XML doesn't have a special element to
denote a line break. XSLT will happily copy any new lines
you put in your source document or ones that you introduce
in the templates, but that can be confusing (people often
get line breaks where they weren't expecting them because of
this; see references to  <xsl:strip-space>,
<xsl:preserve-space> and the normalize-space() function).

Since an element like "<br />" has no "meaning" in XML, and
because it is a perfectly well-formed element, you can put
them directly into your source document and they will be
copied into the result tree (and eventually serialized to
your browser where "<br />" actually does have a meaning).
Or you could introduce it in the XSLT at the appropriate
points.

Charles,

I guess I phrased my Q the wrong way.  I am aware of the fact
that the tags in XML have no specia meaning.  But like any
other programming language there seems to be right and wrong
ways of doing things.  

I am curious to know how others handle a situation I discribed
above.  I believe that I am going to run into this problem in
many places and would like to know the best solution.  Or at
least the auther of the replies best solution.

I do NOT feel that relying on the tradition linebreak is a
good idea.  I figured the best thing to do is denote a line
break in my XML the same way HTML denotes a line break.
Espically considering the target output is HTML.

Sam

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



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