This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: html tags in xml elements



Hi Alice,

Just noticed this, I don't think there were any replies so here goes.

>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>
>
>If I don't use xhtml, do I have to subset the set of html tags
>and redefine them in my DTD?

It depends what you are trying to do!  If your goal is to output HTML from
your source XML file, the answer is no, you don't need to define HTML tags
in your DTD.  It's more likely that you would put your HTML in the XSL
stylesheet, and as long as it is well-formed, the XSL processor will take
care of it.

As I understand it, one goal of XML is to separate presentation from data,
so it is probably not a good a idea trying to include tags like <b> in your
source file.  However, you do need some way of tagging the bits you want to
appear in bold.  This again will depend on why you want certain text in
bold, etc.  Your source XML might then look like this:

<Status>
	<Code>3030</Code>
	<Description>This is an <emphasis>error</emphasis> </Description>
</Status>

In the stylesheet, you would then need a template to convert this to
whatever formatting style you wanted, e.g., something like:

<xsl:template  ...>
<b>
<xsl:value-of select="emphasis" />
</b>
</xsl:template>

Using CSS, you could format it anyway you wanted:

<xsl:template  ...>
<span class="emphasis">
<xsl:value-of select="emphasis" />
</span>
</xsl:template>

Hope this helps.

Steve Perriman
Intranet/Internet Support Technician
South Trafford College




----------------------------------------------------------------------------
---------
This message is sent in confidence for the addressee only. It may
contain confidential or sensitive information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised
recipients are requested to preserve this confidentiality and to advise us
of any errors in transmission. Thank you
----------------------------------------------------------------------------
---------

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]