xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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

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
Keywords
xsl
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor