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

RE: inline XML <emphasis>

Subject: RE: inline XML <emphasis>
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 29 Feb 2008 09:00:10 -0000
RE:  inline XML <emphasis>
> I get very close if I add a closing emphasis tag, 
> </emphasis>, before my literal element and reopen the 
> <emphasis type="default"> after my literal element.

XSLT doesn't deal in tags, in deals in trees and nodes. If you think tags,
you'll never get to grips with the language.

As far as I can see all you're trying to do is to wrap text nodes that
appear as direct children of a para element inside an <emphasis> element wit
the attribute type="default". That's a rule that translates directly into
XSLT:

<xsl:template match="para">
  ...
  <xsl:apply-templates/>
  ...
</xsl:template>

<xsl:template match="para/text()">
  <emphasis type="default">
    <xsl:value-of select="."/>
  </emphasis>
</xsl:template>

In fact, looking back over the thread, I see you were already given this
solution, so heaven only knows why you are still fighting with the problem.

> Just take the identity transformation and add:
> <xsl:template match="para/text()">
>    <emphasis type="default">
>       <xsl:value-of select="."/>
>    </emphasis>
> </xsl:template>
> This way you select only text-nodes which are children of the 
> para  element.
> 

One other point, IIRC your original justification for doing this was that
you found mixed content distasteful. That's a poor rationale.

Michael Kay
http://www.saxonica.com/

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.