|
Subject: RE: [xsl] inline XML <emphasis> From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Fri, 29 Feb 2008 09:00:10 -0000 |
> 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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] inline XML <emphasis>, Thomas Kielczewski | Thread | [xsl] non-standard xsl namespace on, bryan rasmussen |
| Re: [xsl] Insert elment in XSD, George Cristian Bina | Date | Re: [xsl] [ERR XTSE0210] when impor, Michael Ludwig |
| Month |