Write template rules like this:
<xsl:template match="p | p/name | p/title">
<!-- not really needed because this is the default -->
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="note | bibl">
<!-- do nothing -->
</xsl:template>
Michael Kay
Saxonica
On 02/09/2010 9:21 AM, Gábor Tóth wrote:
Dear All,
I wish to process the content of the p element in the following xml
file, however, I would need the text, the content of the title and
author elements but not the bibl and the note element. Here is the
source:
<msItem>
<locus>1r-3v</locus>
<p>This is a sonette by<name>Mario Davanzati</name>,
titled<title>De Amicitia</title>.
<note type="friendship">This is an interesting
sonette about friendship</note>
<bibl>
<author>Mario Davanzati</author>
<title>De Amicitia</title>
<pubPlace>Florence</pubPlace>
</bibl></p>
</msItem>
What I would like to see is:
Description: This is a sonette by Mario Davanzati, titled De Amicitia.
If I write a simple template like this, obviously it takes everything
including the bibl and note elements:
<xsl:template match="msItem">
<h3>Description:</h3><xsl:apply-templates select="p"/>
</xsl:template>
<xsl:template match="p">
<xsl:value-of select="."/>
</xsl:template>
I tried with the | operator ( text() | title | author), but it did not
give the desired solution. I am wondering if there is something like
<xsl:value-of select=".[giving an exception here]"/>
The other part of the problem is that the order of the name, title
element and the text can be different, so<xsl:value-of
select="text()"/> <xsl:value-of select="title"/> and<xsl:value-of
select="name"/>, instead of<xsl:value-of select="."/>, does not help
much.
Thanks,
Gabor
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--