[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] html tags in xml elements


Subject: Re: [xsl] html tags in xml elements
From: Peter Davis <pdavis152@xxxxxxxxx>
Date: Thu, 28 Feb 2002 17:47:16 -0800

If all you're using is a plain DTD, then the XHTML DTD won't work 
because Status and Description are obviously not part of XHTML.  You 
will have to define a subset of XHTML in your DTD and include that subset as 
possible children of the Description tag.  If you want to keep the XHTML 
namespace separate, then you have to hard-code the prefixes for those 
elements (ignore the prefixes in my sample if you don't want to do this).  
DTD's don't know about namespaces, so you have to code in the xmlns:xhtml 
attribute as well.

<!ENTITY % xhtml "(xhtml:b | xhtml:font | xhtml:span | xhtml:div | ...)">
<!ELEMENT xhtml:b ...>
<!ELEMENT xhtml:font ...>

...
<!ATTLIST YourRootElement ...
  xmlns:xhtml "http://www.w3.org/..." #FIXED
>

<!ELEMENT Description (#PCDATA | %xhtml;)*>
<!ELEMENT Status (#PCDATA | %xhtml;)*>

You might have an easier time using a Schema instead of a DTD, since Schemas 
are more geared toward allowing combinations of multiple namespaces.  I'm not 
a Schema expert by any means, but I think you could do: <xs:any 
namespace="##xhtml"> (where "xhtml" is the prefix you use for the XHTML 
namespace).

On Thursday 28 February 2002 13:44, Alice Tull wrote:
> Hi,
>
> Sorry if this is not the right forum. I'm new to xsl/xml,
> and I'd like to have an element in my DTD that allows for
> html tags in it like:
>
> <Status>
> 	<Code>3030</Code>
> 	<Description>This is an <b>error</b> </Description>
> </Status>
>
> I'm at a loss here what to do. Should I use xhtml, and if so,
> how to specify that in the DTD?
>
> If I don't use xhtml, do I have to subset the set of html tags
> and redefine them in my DTD?
>
> thanx,
> alice
>
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
Peter Davis
It's important that people know what you stand for.
It's more important that they know what you won't stand for.

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



Current Thread
Keywords