xsl-list
[Top] [All Lists]

Re: FW: Stopping recursion

2005-11-22 04:52:17
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(_at_)nag(_dot_)co(_dot_)uk>
Reply-To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Date: Tue, 22 Nov 2005 11:21:07 GMT
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: Re: [xsl] 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[(_at_)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[(_at_)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[(_at_)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.

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



<Prev in Thread] Current Thread [Next in Thread>