Subject: Re: [xsl] Processing IDREFS attributes From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Tue, 01 Nov 2005 22:52:51 -0500 |
below
At 02:23 PM 11/1/2005, you wrote:*If* you have properly declared the id attributes, for my example they are called id=, something along the lines of:
<!ATTLIST foo id ID #IMPLIED>
Yes and I had the references defined as IDREFS #IMPLIED as well.
then you should be able to say:
<xsl:for-each select="id(@references)/@id"> <xsl:if test="position()>1"> </xsl:if> <xsl:value-of select="."/> </xsl:for-each>
A slight twist on this does what I wanted, which was to go find the element that has the ID:
<xsl:for-each select="id(@references)/@id"> <xsl:value-of select="id(.)"/> </xsl:for-each>
This produces the content of the element with the assigned ID. Without it, I just got the id value. I'm not sure why you have the position test, can you explain that?
With my original code with added context: <xsl:templete match='foo'> <xsl:for-each select="id(@references)"> <xsl:value-of select="."/> </xsl:for-each> </xsl:template>
It didn't loop for one problem, so there was only a single output, instead of two values as I expected. The output was just the same value as my @references content.
In my original code I had this as well, trying to get to the content of the element referenced, but nothing was being output, so I used the current value just to see if anything was being looked up.
<xsl:value-of select="id(.)"/>
I sort of see why adding the /@id to the for-each select worked, but I don't know why mine didn't work or like you said didn't give me all the content.
-- World-wide on-site corporate, govt. & user group XML/XSL 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Processing IDREFS attribu, Dan Vint | Thread | Re: [xsl] Processing IDREFS attribu, Wendell Piez |
[xsl] matching template with argume, Charles Ohana | Date | Re: [xsl] [XPath20] Decoding URIs, Colin Paul Adams |
Month |