[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: question?
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 nodes > 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 text > nodes...even though you couldn't visually see where one starts and one ends. > The parser had them as separate nodes, and until you do something with them, > they remain separate. That's why text nodes are de-normalized by default with > 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 an > 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@x...&BODY=unsubscribe%20xml-dev List archives are available at http://xml.org/archives/xml-dev/ ***************************************************************************
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|