|
Subject: [xsl] Creating exception in processing a node From: Gábor Tóth <roysy@xxxxxxxx> Date: Thu, 2 Sep 2010 09:21:54 +0100 |
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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Moving elements during id, Dimitre Novatchev | Thread | Re: [xsl] Creating exception in pro, Michael Kay |
| Re: [xsl] Saxon .Net API performanc, Michael Kay | Date | Re: [xsl] Creating exception in pro, Michael Kay |
| Month |