Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<![CDATA[ ... ]]>

Status
Not open for further replies.

mountainbiker

Programmer
Aug 21, 2002
122
0
0
GB
If the XML instance contains something like
Code:
<![CDATA[<br />]]>
. Is it possible to get that
Code:
<br />
the whole way to the transformed HTML as a line break and not just a string? Wouldn't that be cool?
 
The content of the cdata section is just like a text node to the parser and transformation engines. So you can use it in the output of a transformation just as any other text node.

-pete

 
So that is a 'No' and CDATA data simply comes across to the transformation as string text :(
 
>> So that is a 'No'

Well honestly, i don't understand your orginal post so i can't verify &quot;Yes&quot; or &quot;No&quot;.

It seems to be saying that you desire an HTML line break to be output when there is a
Code:
<br />
text in a CDATA section. Of course a
Code:
<br />
is a HTML line break so i am confused.

-pete

 
Okay, assume you are sitting at a input template with something like XetMaL sitting behind the scene. You are entering data into the form which will be the XML instance. In say the <Para></Para> portion of data entry, you add a <!CDATA[<br />]] into your data entry. Will/can this <br /> make it through the XLS trransformation into you HTML output? For example,
Code:
<p>Mary had a little lamb<br /> with mint sauce.</p>
 
Ok, sorry. I didn't follow the explanation until i saw the example XML. DOH!

[machinegun] ...(pete)

-pete

 
I have a similar question, I would like to have a CDATA Element declared like:

<!ELEMENT name CDATA>

and then in the xml file:

<name>Hi, I can use <strong>strong</strong> tags if I feel like it </name>

but I get two distinct problems when running through a validator (validator.w3.org):

1) warning: CDATA declared content for every instance of the dtd that I've declared an element with CDATA and worse yet:

2) end tag for element "strong" which is not open.

what is going on? I thought CDATA wasn't supposed to be parsed. Basically, I'd like to sneak some xhtml into my xml dtd how can I do that so that tags like <strong> <em> and those sorts make it through?

ANy help is appreciated, on both 1 and 2 above.

warmest regards,

-Alex
 
CData tage are there to allow you to pass text which would normally be interpreted by the XML parser. The only text which isn't allowed is another <![CDATA[ ]]> pair (which is why you can't nest CData tags).

Alex -
In your case, use the entity [ignore]&lt;[/ignore] for your less-than symbol and [ignore]&gt;[/ignore] for your greater-than symbol, etc.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
* BUMP *

alex,

any luck in sneaking xhtml through? i haven't.

mb
 
I thought I did, but the best I was wrong. I inserted some CDATA regions into my XML like:

<![CDATA[<em>]]>empahsize me<![CDATA[</em>]]>

but somewhere in the process the < becomes a &lt; and the > becomes &gt; and it's therefore not interpreted as a tag but as text. I wonder if there's something I can do in XSL to convert &gt; back to >?
 
BUT! I just came across this page:


It basically explains how to do just what we are trying to do, put HTML into XML. They describe use of the <xsl:copy-of> tag and also use of an http namespace for html content.

I'm just reading it now, and since I couldn't possibly explain it any better than it already is written, I highly recommend you should just take a look directly.

-Alex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top