|
Subject: Re: [xsl] xsl and xml CDATA or Not question From: Peter Flynn <pflynn@xxxxxx> Date: Fri, 12 Mar 2004 16:56:45 +0000 |
On Fri, 2004-03-12 at 15:49, John Hamman wrote:
> hello experts,
> If i have some html in a xml field like below.
XML doesn't have "fields" -- they're for databases.
XML has elements.
> <Content><![CDATA[ <br/><br/><center><div id="TextOnlyLink"><a
> href="/page.aspx?textonly">[Text Only]</a></div>
> <div id="centerImg">
> <img src="/pub/en-us/images/clear-path-soon.jpg" alt="the alt tag."
> width="712" height="223"/>
> </div>
> <p>blah blah blah</a>
> </p>
> </center>]]>
> </Content>
But that isn't HTML any more. Putting it in a CDATA section
means you want it treated as plain text. That's what CDATA
sections are for. What is wrong with (indents added for
illustration only):
<Content>
<br/>
<br/>
<center>
<div id="TextOnlyLink">
<a href="/page.aspx?textonly">[Text Only]</a>
</div>
<div id="centerImg">
<img src="/pub/en-us/images/clear-path-soon.jpg"
alt="the alt tag" width="712" height="223"/>
</div>
<p>blah blah blah*</p>
</center>
</Content>
* I've removed the spurious </a> which must be a corruption.
If you are being supplied with this by someone else, tell
them to generate well-formed XHTML otherwise it can't be
processed. They've taken the trouble to add the / at the
end of the <img/> element, so I'm not clear why they felt
it important to add a meaningless </a> and then deliberately prevent it
being used as XHTML.
> my formated xsl is just this
> <xsl:value-of select="//Content" disable-output-escaping="yes"/>
With the above you can use the xsl:copy-of that David
suggests.
> but my question is how do i take that contnet and be able to use it in a way
> with another "text only" xsl sheet that might make it output like this
>
> <a href="/page.aspx">[Formated]</a>
> [img: the alt tag]
> <p>blah blah blah<p>
Tip: alt is not a tag, it's an attribute on the img element type.
> Any ideas. Im sure im missing something somewhere. Should i get rid of the
> CDATA and figure a way to output it as regular HTML in the formated version?
Yes. If it's XHTML, then handle it as such.
///Peter
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] xsl and xml CDATA or Not , David Carlisle | Thread | RE: [xsl] xsl and xml CDATA or Not , John Hamman |
| Re: [xsl] binding xml to stylesheet, Wendell Piez | Date | RE: [xsl] problem converting xml to, Michael Kay |
| Month |