Re: [xsl] xalan:nodeset

Subject: Re: [xsl] xalan:nodeset
From: "Nima Kaviani" <nkaviani@xxxxxx>
Date: Sun, 26 Nov 2006 16:38:07 -0800
Hi Guys,

thanks a lot for the replies.

>J.Pietschmann wrote:
>
>The real question is: why do you actually create the "contexts"
>variable as RTF? You should be able to do the following, without
>the nodeset() extension:
>
>  <xsl:param name="contextID" select="policy:context/@rdf:resource"/>
>  <xsl:variable name="contexts"//constraint:SimpleConstriant[@rdf:ID
>                     = $contextID]"/>
>
>  <xsl:for-each select="$contexts">
>      <xsl:value-of select="@rdf:ID"/>
>  </xsl:for-each>

I tried this one first but surprisingly it didn't work. So I thought maybe I had to use RTF to solve the issue, but apparently not! Now I copied it as you have instructed in your code and it is working fine! I think I might have had a typo or something in my code the first time I tried it. but still the RTF version doesn't work and I am not gonna go through it for now.

Joe wrote:

To the OP, are you sure you want SimpleConstriant rather than
SimpleConstraint

Thanks Joe, you are right. there was a typo by the time I copied and pasted my code to my email but before posting it to the list I had tested it without any typo and it didn't work. even after you pointed it out I corrected it again but still no success :(

anyways by now I am gonna leave it as is.

Does anyone know of a good XSL IDE/Editor for Linux? emacs, vi and
even X-based text editors are not good enough to detect the typos.

thanks,
-Nima


On 11/26/06, Joe Fawcett <joefawcett@xxxxxxxxxxx> wrote:
>From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
>Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>Subject: Re: [xsl] xalan:nodeset
>Date: Sun, 26 Nov 2006 13:56:32 +0100
>
>Nima Kaviani wrote:
>>I have the following XML file:
>[snip]
>>and I have used the following construct to store some of the elements
>>in a variable based on an equality between the values of the
>>attributes:
>>
>><xsl:param name="contextID" select="policy:context/@rdf:resource"/>
>><xsl:variable name="contexts">
>>     <xsl:copy-of select="//constraint:SimpleConstriant[@rdf:ID =
>>$contextID]"/>
>></xsl:variable>
>>
>>apparantly the variable "contexts" has stored the relevant information
>>but when I try to read it, using for-each or whatever else, nothing is
>>displayed. so the code below is not working:
>>
>><xsl:for-each select="xalan:nodeset($contexts)">
>>     <xsl:value-of select="constraint:SimpleConstriant/@rdf:ID"/>
>></xsl:for-each>
>>
>>while <xsl:copy-of select="xalan:nodeset$contexts)"/> shows that the
>>desired values are stored in the variable.
>
>Selecting from a RTF-converted-nodeset can be tricky, however it looks
>like that the context elements in the for-each are already the
>constraint:SimpleConstriant elements, and you can just select the
>necessary attribute.
>
>The real question is: why do you actually create the "contexts"
>variable as RTF? You should be able to do the following, without
>the nodeset() extension:
>
>  <xsl:param name="contextID" select="policy:context/@rdf:resource"/>
>  <xsl:variable name="contexts"//constraint:SimpleConstriant[@rdf:ID
>                     = $contextID]"/>
>
>  <xsl:for-each select="$contexts">
>      <xsl:value-of select="@rdf:ID"/>
>  </xsl:for-each>
>
>
>J.Pietschmann
>
Small typo in your answer :)

<xsl:variable name="contexts" select="//constraint:SimpleConstriant[@rdf:ID=
$contextID]"/>

To the OP, are you sure you want SimpleConstriant rather than
SimpleConstraint?

Joe

Current Thread