Subject: RE: [xsl] keys and idrefs From: DPawson@xxxxxxxxxxx Date: Tue, 9 Oct 2001 11:40:40 +0100 |
Hi Wendell. > >With XML such as > > <process id="schemaDesign" layer="datalayer" control="XAG > >systemArchitecture" input="systemSpec "> > > <name>Schema Design</name> > > </process> > > > >and lots of similar, > > > >then lots of <document elements> > > > > <document id="XAG" layer="WAI" > > > <name>XML Guidelines</name> > > </document> > > > > > >I.e. the idrefs (control attribute on <process>) point to > the controlling > >documents. > > > >I'm trying to present the list of processes controlled by > the document in an > >html para. > > So you want process elements back, using @control: > > <xsl:key name="processes-by-control" match="process" use="@control"/> > >in the template for 'document' I'm using the hack > > > > <xsl:template match="document"> > > <xsl:variable name="thisDoc" select="@id"/> > >..... > > <p> Controls: > > <xsl:for-each > >select="id(//process|//document[@control='$thisDoc'])"> > > <a href="{@id}.html"> <xsl:value-of select="name"/> > ></a>  > > </xsl:for-each> > > </p> > > So you'd have > <xsl:for-each select="key('processes-by-control', @id)"> ... Which only appears to return a single value, where <xsl:for-each select="//process "> <xsl:if test="contains(@control, $thisDoc)"> <a href="{@id}.html"> <xsl:value-of select="name"/> </a>  returns 5 process element whose control attribute contains the id value of the current node. Unsure, but the symptoms are that it finds an idref which is alone, but not those which are second or further in the list of idrefs. E.g. <process id="metadataDesign" control="XAG" > <name>Metadata Design</name> </process> is found, for XAG <process id="deliver" control="DIGL WCAG XAG UANegotiation" > <name>Deliver Content</name> </process> but this is not found for XAG. Hence the use of my solution for treating the idrefs as a string, rather than an attribute value. > > Since you want <process> elements back and @control on each > process is an > IDREF, not an ID, I think you have to use keys; the id() > function only goes > the other way. No, its an idrefs (plural) not an idref, which I think is the heart of the matter. Regards DaveP ************ snip here *********** - NOTICE: The information contained in this email and any attachments is confidential and may be legally privileged. If you are not the intended recipient you are hereby notified that you must not use, disclose, distribute, copy, print or rely on this email's content. If you are not the intended recipient, please notify the sender immediately and then delete the email and any attachments from your system. RNIB has made strenuous efforts to ensure that emails and any attachments generated by its staff are free from viruses. However, it cannot accept any responsibility for any viruses which are transmitted. We therefore recommend you scan all attachments. Please note that the statements and views expressed in this email and any attachments are those of the author and do not necessarily represent those of RNIB. RNIB Registered Charity Number: 226227 Website: http://www.rnib.org.uk XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] keys and idrefs, Wendell Piez | Thread | Re: [xsl] keys and idrefs, David Carlisle |
Re: [xsl] XML Schema/XSL conflict (, David Carlisle | Date | [xsl] xsl not working when transfor, marc . harrington |
Month |