[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSLT 2.0 contains question

Subject: Re: XSLT 2.0 contains question
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Mon, 09 Apr 2007 21:40:38 +0200
Re:  XSLT 2.0 contains question
David Carver wrote:
Under XSLT 1.0, I can do the following to filter out any xsd:element that has a xsd:documentation element that has the word "Deprecated" in it.

<xsl:template match="xsd:schema">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:for-each select="xsd:element | xsd:complexType">
<xsl:if test="count(xsd:annotation[contains(xsd:documentation, 'Deprecated')]) = 0">
<xsl:apply-templates select="."/>
</xsl:if>
</xsl:for-each>
</xsl:copy>
</xsl:template>



However, under XSLT 2.0, I get an error because contains can't take a more than xsd:documentation element. What is correct way to handle this under XSLT 2.0.



I suppose you mean: fn:contains does not take a sequence of nodes as its first argument. You should specify precisely what you want, so either:


(: first xsd:documentation :)
xsd:documentation[1]

or:

(: all xsd:documentation concatenated :)
string-join(xsd:documentation, '')

or (better):

(: all xsd:annotation having at least one xsd:documentation with 'Deprecated' :)
xsd:annotation[xsd:documentation[contains(., 'Deprecated')]]


HtH,

Cheers,
-- Abel Braaksma

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.