xsl-list
[Top] [All Lists]

[xsl] selecting a element without it's child element

2010-11-10 04:07:44
Hi Experts,

I need to select an element and store in a variable, but not the child
element of that particular element.

My XML

<book><title><indexterm>Violent Extremism</indexterm> Sacred Values, and
what it Means to be Human</title></book>

My XSLT:

<xsl:variable name="filename"><xsl:value-of select="book/title except
child::indexterm"/></xsl:variable>

<xsl:template match="/">
<xsl:message><xsl:value-of select="$filename"/></xsl:message>
</xsl:template>

My Current output:

Violent ExtremismSacred Values, and what it Means to be Human

My Expected output:

Sacred Values, and what it Means to be Human

The content of "indexterm" element should not be part of the file name. I
need to ignore that element while selecting the title element.

Can you please give me the solution for this? I am not sure if I am using in
the right way of "except" expression.

I am using XSLT 2.0 and Saxon.

Thanks
Srinivasan
 



--~------------------------------------------------------------------
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>
--~--