OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: question?

[ Lists Home | Date Index | Thread Index ]
  • From: tpassin@home.com
  • To: <xml-dev@xml.org>
  • Date: Thu, 15 Jun 2000 22:49:40 -0400

Mike Sharp responded to Michael O' Dell's question (in part) -
> Aha! Now I understand your question...The way I understand it (hopefully
if I'm
> wrong, somebody will set me straight), there are actually multiple text
> within the description.  Text nodes do not have delimiters in and of
> themselves--they are contained within another element.  So in reality,
> Description contains a substructure with three nodes:
> 1. Some Text
> 2. Link
> 3. Some More text
> The xsl:value-of tag de-normalizes the text nodes into one node, by
default.  In
> fact, it's my understanding that if you programmatically removed the
<link> tag
> in the description element of a parsed XML document, you'd still have two
> nodes...even though you couldn't visually see where one starts and one
> The parser had them as separate nodes, and until you do something with
> they remain separate. That's why text nodes are de-normalized by default
> the xsl:value-of.
> The basic rule is, if the xsl pattern returns more than a single node, the
> xsl:value-of element returns the text of the first node.  This is
equivalent to
> the XMLDOMNode object's selectSingleNode method. If the node returned is
> element with substructure, as in your case, xsl:value-of returns the
> concatenated text nodes of that element's subtree with the markup removed.
> That said, I would probably avoid just such a structure, if I could,
because I
> don't feel it's clear...

I use an identical structure myself to produce certain web pages - it's even
got an inline link like Mike O'Dell's example - and it transforms with XSLT
just as I intended.

Another way to look at it is to look at the element declaration for mixed
content that looks like this example:

<!ELEMENT theElement (#PCDATA|link|other-in-line)*>

This says that, at any position within an instance of theElement, you can
have a character, a <link> element, or an <other-in-line> element, and you
can have as many of them as you like.  That's just what M. O'D has in his
example.  Nothing unusual about the element declaration.

So there's really no surprise that "it works" under XSLT.

Tom Passin

This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS