[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Mixed content: selecting current context w/out child

Subject: Mixed content: selecting current context w/out child
From: "John E. Simpson" <simpson@xxxxxxxxxxx>
Date: Sat, 13 Mar 1999 10:50:48 -0500
Mixed content: selecting current context w/out child
This has got to be a fairly elementary question.... What's the proper
select expression to retrieve *only* the PCDATA portion of a mixed-content
element, *not* the contents of its children?

Here's a content model:
    <!ELEMENT name (#PCDATA | role)* >

Given the following XML:
    <name>Candace Hilligoss<role>Mary Henry</role></name>

What XSL would produce the following HTML?
    <tr>
      <td>Candace Hilligoss</td>
      <td>Mary Henry</td>
    </tr>

I've tried what feels like 47 or so different incrementally-different
solutions, such as this:
    <xsl:for-each select="name">
      <tr>
         <td><xsl:value-of select="."/></td>
	   <td><xsl:value-of select="./role"/></td>
      </tr>
    </xsl:for-each>

In all cases, the first select deposits the contents of not just the <name>
tag's PCDATA ("Candace Hilligoss"), but also its <role> child ("Mary
Henry", in the first <td> cell. (The second one, no problem; however, the
<role> child itself has no children, so this may be an illusory
"solution.") I suspect I've just been obsessing about this too much and am
overlooking the obvious.

Thanks for help, per usual,
JES

P.S. One thing that using XSL is teaching me is the importance of avoiding
mixed content models wherever possible. The next version of my DTD will
eliminate most of them. For now, though, I'm stuck with the content model
I've got.

==========================================================
John E. Simpson            | The secret of eternal youth
simpson@xxxxxxxxxxx        | is arrested development.
http://www.flixml.org      |  -- Alice Roosevelt Longworth


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.