473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

html tags within meta tags allowed?

Are html tags allowed within meta tags? Specifically, if I have html
tags within a <definition> tag within XML, can I use the definition as
the content within the <meta content="description> tag? If not, is
there an easy way to strip the html tags from the <definition> content
before inserting the content into the meta tag?

Jul 20 '05 #1
5 3730
Donald Firesmith wrote:
Are html tags allowed within meta tags? Specifically, if I have html
tags within a <definition> tag within XML, can I use the definition as
the content within the <meta content="description> tag? If not, is
there an easy way to strip the html tags from the <definition> content
before inserting the content into the meta tag?


An attribute cannot contain elements, you can easily extract the text
only by using

<xsl:value-of select="normalize-space(description)" />

--
Klaus Johannes Rusch
Kl********@atmedia.net
http://www.atmedia.net/KlausRusch/
Jul 20 '05 #2
On Wed, 05 Jan 2005 02:35:46 -0500, Donald Firesmith
<do**************@hotmail.com> wrote:
Are html tags allowed within meta tags?
Learn the difference between tags, elements and attributes.

Specifically, if I have html
tags within a <definition> tag within XML, can I use the definition as
the content within the <meta content="description> tag?


Let's rephrase that as "Can I represent the content of one element as
the content of an attribute of another element ?"

In that case, then yes you can - with the proviso that you need to be
careful about the meaning of "represent". The content models of
elements and attributes are different, so you can't just "place" that
of any element into an attribute, as it might contain the "<>"
characters that mark out a tag (and are not permitted in attributes).

But you can represent this, with a process known as entity encoding.
The "awkward" characters <>&' are replaced with their entity encoded
representations of &lt; &gt; &amp; & &apos;

Note that you have now done something "outside" of XML. XML does
_not_ (and cannot) know what you've done, or that the contents of the
destination element's attribute should be de-encoded on reading. It's
a simple process to do, but it's not simple for the recipient to
"know" that it ought to do this. there is _no_ way for "an XML tool"
to recognise that it ought to - after all, the content is well-formed
XML either way, it's just a question of interpreting its meaning.

A common case where this is done is with RSS (although that's just put
into another element, not an attribute) Because most of the RSS specs
are so poorly written, there is great confusion here.
http://diveintomark.org/archives/200...compatible-rss

This is thus why in your literal example you _can't_ do what you're
trying to do. Yes you could do it, but no you shouldn't. It is not
"meaningful" (in the sense of understanding, not the sense of XML) to
place encoded content, or anything resembling HTML or XML tags into
the content attribute of a HTML <meta> element. The readers of it (of
which there are very few) just aren't expecting to see it in there and
they won't know what to do with it. They certainly won't have the
action you're optimistically hoping for, sensible though that might
have been (had we all know what the game was and how to play along).

--
Smert' spamionam
Jul 20 '05 #3
Andy Dingley wrote:
On Wed, 05 Jan 2005 02:35:46 -0500, Donald Firesmith
<do**************@hotmail.com> wrote:

Are html tags allowed within meta tags?

Learn the difference between tags, elements and attributes.
Specifically, if I have html
tags within a <definition> tag within XML, can I use the definition as
the content within the <meta content="description> tag?

Let's rephrase that as "Can I represent the content of one element as
the content of an attribute of another element ?"

In that case, then yes you can - with the proviso that you need to be
careful about the meaning of "represent". The content models of
elements and attributes are different, so you can't just "place" that
of any element into an attribute, as it might contain the "<>"
characters that mark out a tag (and are not permitted in attributes).

But you can represent this, with a process known as entity encoding.
The "awkward" characters <>&' are replaced with their entity encoded
representations of &lt; &gt; &amp; & &apos;

Note that you have now done something "outside" of XML. XML does
_not_ (and cannot) know what you've done, or that the contents of the
destination element's attribute should be de-encoded on reading. It's
a simple process to do, but it's not simple for the recipient to
"know" that it ought to do this. there is _no_ way for "an XML tool"
to recognise that it ought to - after all, the content is well-formed
XML either way, it's just a question of interpreting its meaning.

A common case where this is done is with RSS (although that's just put
into another element, not an attribute) Because most of the RSS specs
are so poorly written, there is great confusion here.
http://diveintomark.org/archives/200...compatible-rss

This is thus why in your literal example you _can't_ do what you're
trying to do. Yes you could do it, but no you shouldn't. It is not
"meaningful" (in the sense of understanding, not the sense of XML) to
place encoded content, or anything resembling HTML or XML tags into
the content attribute of a HTML <meta> element. The readers of it (of
which there are very few) just aren't expecting to see it in there and
they won't know what to do with it. They certainly won't have the
action you're optimistically hoping for, sensible though that might
have been (had we all know what the game was and how to play along).

Okay. Then what are you supposed to do in the following situation?
Assume that you have over 1000 items that you want to document using
XML instead of HTML. For the foreseeable future, you will use them to
generate webpages primarily for human consumption. You are mainly
converting from HTML to XML so that you can build tools that help you
select and tailor the contents of these 1000 items.
Each of these items has one or more of several kinds of parts. These
parts vary from item to item and you want to be able to pull out the
content of these variable parts into XML so that you can use XSL to
capture the common standard structure and contents. However, the
variable parts are more complex than simple prices, model numbers, etc.
They have enough variablity to include links, optional sublists, and
other information that requires proper formatting that appears not to be
able to be captured in a single XSL. That is why you want to include
the HTML tags. Specifically, check out the 1,100+ free open source
reusable process components within the OPEN Process Framework repository
at www.donald-firesmith.com. If you look at several examples of the
same metatype, you will quickly see the kind of variability I am talking
about. So far, I have created activity DTD and XSL files and an XML
file for the requirements engineering activity. I am sure that they are
probably not the world's best examples of XSL and XML style. But I am
not sure how to improve them and still retain the desired look and feel
of the resulting XHML webpages. I would be happy to send anyone who is
interested the three example files and would greatly appreciate any
recommendations, especially if these recommendations are specific and
even more so if they come back in the form of modified DTD, XSL, and/or
XML files. The examples I see in the books are always very simple and
far more standardized that the HTML that I am trying to transform into XML.
By the way, the OPEN Process Framework Repository Organization is a
non-profit volunteer organization with no funding to pay for a
consultant to do the conversion for us. That is why we are relying on
groups such as this one to help us do a good job.

Donald Firesmith
Chair, OPEN Process Framework Repository Organization

Jul 20 '05 #4
On Wed, 05 Jan 2005 23:25:28 -0500, Donald Firesmith
<do**************@hotmail.com> wrote:
Okay. Then what are you supposed to do in the following situation?
There are two levels at which you have to think.

First of all is a project management level. You're putting a big new
system together and you're doing it with a wide range of new tools.
You need to understand these tools before using them - otherwise your
chosen design might be rather less than ideal....

Of course, a budget would allow you to hire in some help at this
point. I can tell you that a few days of my consultancy rates are
_much_ cheaper than a few months of my grunt coder rates trying to fix
it afterwards. Not that any project manager ever listens, oh no.

The second level is that of the design itself. Much of this is based
around toolsets or platforms, both those that are appropriate and
those particularly familiar from past experience. XLink is probably
relevant to you, XSL:FO isn't. Are you a Java & Unix shop, or a M$oft
gulag ?

It's typical of XML that the tools chosen aren't particularly
problem-specific. I can sketch out a rough architecture for you, and
the tools you need to look at, and this will be the same whether
you're describing your knowledge-based virtual product, or tins of
beans in a supermarket. It's a bottom-up design process - the tools
are chosen by your need to publish in HTML, and your entities' need to
represent their inter-linkage, not what the entity itself is about.
Assume that you have over 1000 items that you want to document using
XML instead of HTML. For the foreseeable future, you will use them to
generate webpages primarily for human consumption. You are mainly
converting from HTML to XML so that you can build tools that help you
select and tailor the contents of these 1000 items.


Been there, done that, have an entire wardrobe of conference t-shirts
on the subject.

Ditch the HTML fixation. HTML has three good things about it; it's the
thing to use for final-stage publishing because it gives you
web/intranet access at very low cost. It's familiar to many people for
authoring, so you can use it as an internal lightweight text editing
format and capitalise on much existing experience. It also has some
features for representation of text formatting and some _minimal_
features for representing links.

On the other hand, it's not what you need for the internal
representation of abstract data. There are uses for it in the external
interface, but no needs for it in the internal representation. In
patrticular, choosing HTML as the basis for your link representation
is going to be a whole world of pain. Forget using HTML to represent
your links. Look at XLink instead (a bunch of properties you'd place
on one of your other elements).

For HTML, use XHTML. Trust me. You can always make it into HTML 4.01
at the last moment, but keeping your internal data stream as XML-clean
not HTML or SGML is a big saving of effort.

I'd suggest Schema over DTD, and possibly looking at OWL.

In general, don't invent a new schema but assemble one from
pre-existing and widespread standards. Namespacing is useful here.
You will probably need to invent _some_ schema, but this can be very
minimal - just a container for properties that are described by
pre-existing schemas.

Look into Dublin Core, particularly the qualified form. You can do an
awful lot with just this much, and it gives you useful benefits to
external publishing in a vaguely communicable format.

For representing text markup, then you can use either HTML or DocBook.
I don't particularly like either, but not using one of them is a brave
decision that would require some real justification. Both are bloated
by legacy features (especially DocBook), neither are particularly
powerful in a general sense.

XSLT can do nearly everything you need here, including the
construction of all the linkage in external HTML that you might ever
wish. XSLT isn't the general solution to everything that is often
claimed, but it'll do you here.
If it were me, I'd use RDF instead of XML. It has advantages for this
sort of meta-description problem. These are mainly in the ability to
build such a system and then exchange its data with external systems
in a fairly easy manner.

XML is _very_ low-level. You have no implied data model to it. until
you build one with schema. RDF gives you a little more than this, and
it gives it to everyone in a consistent and commonly shared manner.
There are objects (with implied notions of identity) and they can have
properties. these properties can in turn have type, which may be
shared between different properties. Type in turn may be used to imply
values being members of a controlled vocabulary.

A controlled vocabulary for your properties is an excellent thing to
have, and OWL is a useful way to express them.


As to publishing in HTML, then this is easy but also trivial. Your
original question of how to publish structured content in the
attributes of a <meta> element is well-intentioned but somewhat
misguided. You can publish here, but there's nothing that will look at
it to try and read it.

HTML, as an output authoring medium is for human readable use only.
(this sucks, but make the most of it). Forget trying to publish really
complex machine-processable metadata by it.

If you really wish to, look at the well-desciribed techniques for
embedding Dublin Core within HTML (this is as far as one can
practically go these days). To push things further, even though it's
still optimism rather than consumer demand that's driving it, use
XHTML and embed some RDF within it by namespacing.
You might find it useful to read up on the Semantic Web techniques,
for which I'd suggest Passin's "Explorer's Guide to the Semantic Web"
<http://www.amazon.com/exec/obidos/tg/detail/-/1932394206/codesmiths-20>
--
Smert' spamionam
Jul 20 '05 #5
Donald Firesmith wrote:

[snip]
Okay. Then what are you supposed to do in the following situation?
Assume that you have over 1000 items that you want to document using
XML instead of HTML.


Put them all into XML. Natively. Don't try to preserve HTML within XML,
make it *all* XML. You can trivially convert data back to HTML when you
create the Web pages if it's been properly marked up in the first place.
The "proper formatting" can then be a function of the XML markup.

///Peter
--
"The cat in the box is both a wave and a particle"
-- Terry Pratchett, introducing quantum physics in _The Authentic Cat_
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

32
by: Werner Partner | last post by:
I put this question already, but erhaps it "came under the wheels" because it was hidden in another thread. Nevertheless it's important for me to understand the problem and solve it. Old html...
54
by: Howard Kaikow | last post by:
Where is the official documentation of what constitutes a minimally compliant HTML file? -- http://www.standards.com/; See Howard Kaikow's web site.
12
by: thomas_jedenfelt_1 | last post by:
Hi everyone, Is the W3C HTML Validator in error when it returns <br /> as valid for HTML 4.01 Strict doctype? In March 2004 , the Validator returned <br />, <hr /> and <img /> as invalid for...
82
by: Eric Lindsay | last post by:
I have been trying to get a better understanding of simple HTML, but I am finding conflicting information is very common. Not only that, even in what seemed elementary and without any possibility...
5
by: acord | last post by:
Hi, I m getting annoying display problem when placing javascript tags in a html page. Should the javasscript tags placed at the beginning of a html page before anything start? or placed between...
3
by: salucci | last post by:
in a HTML page containing editorial data of a book, should be used html meta tags, dublin core tags, or both? If last option, html tags should refer to HTML page and DC tags to book, or what? over...
1
by: darrel | last post by:
I have built a CMS for a client and he now wants to add his own meta tags to each page. I don't want to deal with making separate DB fields for every potential meta tag and I figure that more...
1
by: ludwiga | last post by:
Hi all, I am trying to validate my first web site and most of the common errors that i am getting are the following!!! I am sure you can help me thanks in advance. <!DOCTYPE HTML PUBLIC...
0
by: Guy Macon | last post by:
Moon wrote: It isn't a question of relative vs. full URL paths in your meta tags. It is a question of following the paths (relative or full URL) in your meta tags vs. not reading the meta tags...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.