Subject: Re: [xsl] key() question? From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Wed, 10 Jul 2002 10:58:21 +0100 |
Hi Steven, > I have some keys declared for easy access to the attributes declared for > a specific element, and to retrieve the contentModels in which an > element is referred to: > > <xsl:key name="attlistbyname" match="/dtd/attlist" use="@ename"/> > <xsl:key name="contentmodelbychildren" match="//contentModel" > use="descendant::element/@name"/> [A // beginning a pattern (match attribute) is always superfluous -- you're matching "any contentModel element that is a descendant of the root node" when you may as well match "any contentModel element" since all elements must be descendants of the root node by definition.] > My question is how I can easily locate <contentModel> elements which > don't have an <element> counterpart bearing an attribute 'name' with > the contentModel/@ename as its value. If you're looking at a contentModel element, then you can find all the element elements that have the same name as that contentModel element using your contentmodelbychildren key with the value of the ename attribute on the contentModel element: key('contentmodelbychildren', @ename) If there are no element elements returned by the key, then the element is never referred to from within a content model. So you can collect all the contentModel elements that don't return any nodes when their ename attribute is passed to the 'cotentmodelbychildren' key: /dtd/contentModel[not(key('contentmodelbychildren', @ename))] Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] key() question?, Steven Noels | Thread | Re: [xsl] key() question?, Steven Noels |
[xsl] key() question?, Steven Noels | Date | [xsl] Re: key() question?, Dimitre Novatchev |
Month |