xsl-list
[Top] [All Lists]

RE: [xsl] inline XML <emphasis>

2008-02-29 02:00:35
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/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>