[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: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 09 Apr 2007 15:11:25 -0400
Re:  XSLT 2.0 contains question
At 2007-04-09 15:07 -0400, I wrote:
At 2007-04-09 14:51 -0500, 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.

Actually, no ... your code only filters out any xsd:element whose *first* xsd:documentation child element has the word "Deprecated" in it, not "any" as you say.

Sorry, David, I incorrectly cited the word "any" ... I interpreted you implying with "that has a xsd:documentation element" that if there are more than one of them that any of them can have the word "Deprecated" in it.


The rest of the post stands, I just realized that I incorrectly wrote my first paragraph.

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

The correct way to handle this in both XSLT 1 and XSLT 2 is as follows:


<xsl:if test="not(xsd:annotation/xsd:documentation[contains(.,'Deprecated')])">

This expression will check all xsd:documentation children of xsd:annotation.

I hope this helps.

. . . . . . . . . . Ken


--
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

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-2011 All Rights Reserved.