Re: FW: Stopping recursion
Thanks, that is certainly an improvement on what I had. Now if more than one child of a complex type has @namespace="xlink" I don't duplicate the attribute declaration. However it doesn't always cure the problem if more than one complex type referred to by descendants of a "parent" complex type has the XLink namespace. Say the first complex type has no XLink namespace, but references two more complex types. The elements of both these complex types are checked in turn, and if they both have the XLink namespace I end up with two attribute declarations. > From: David Carlisle <davidc@xxxxxxxxx> > Reply-To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> > Date: Tue, 22 Nov 2005 11:21:07 GMT > To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> > Subject: Re: FW: Stopping recursion > > > I suspect it's not really the recursion you want to stop but the > for-each. If any of these has the xlink then you want to output > the attribute and stop. > So don't loop over all of them, just check if any of them have the > attribute: > > <xsl:choose> > <xsl:when test="/xsd:schema/xsd:complexType[@name = > $myType][.//@namespace='http://www.w3.org/1999/xlink]"> > <xsd:attribute ref="xml:base"/> > </xsl:when> > <xsl:otherwise> > <xsl:apply-templates select="/xsd:schema/xsd:complexType[@name = > $myType]//xsd:element" mode="findXLink"/> > </xsl:otherwise> > > > If your schema is large you would likely get significant speedup if you > replaced all occurrences > of > /xsd:schema/xsd:complexType[@name = $myType] > by > key('type', $myType) > defined via > > <xsl:key name="'type' match="/xsd:schema/xsd:complexType" use="@name"/> Thanks for the tip. > > David All the best Mark The information in this e-mail is sent in confidence for the addressee only and may be legally privileged. Unauthorised recipients must preserve this confidentiality and should please advise the sender immediately of the error in transmission and then delete this e-mail. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on its content is prohibited and may be unlawful. Origo Services Limited accepts no responsibility for any loss or damage resulting directly or indirectly from the use of this e-mail or the contents. It is your responsibility to scan for viruses. Origo Services Limited reserves the right to monitor e-mails sent to or from addresses under its control. When you reply to this e-mail, you are consenting to Origo Services Limited monitoring the content of the e-mails you send to or receive from Origo Services Limited. If this e-mail is non-business related Origo Services Limited is not liable for any opinions expressed by the sender. The contents of this e-mail are protected by copyright. All rights reserved. Origo Services Limited is a company incorporated in Scotland (company number 115061) having its registered office at 4th floor, Saltire Court, 20 Castle Terrace, Edinburgh EH1 2EN.
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format