Re: Re: variables inside itemsets
Posted by
Jeremiah Jahn-4 on
Jan 20, 2010; 12:23pm
URL: https://discuss.orbeon.com/variables-inside-itemsets-tp1017167p1018356.html
Awesome, thank you so much. worked like a dream.
I didn't realize you could use value="" there. Yeah! cleaner code.
On Jan 19, 2010, at 10:01 PM, Alessandro Vernet wrote:
Jeremiah,
First, those ref="xxforms:attribute(foo, bar)" look a bit fishy to me ;). Instead, what about using value="bar"?
Assuming you can, the difficulty seems to be with the expression:
instance('types')/types/type[@typeID = $currentItemName]/label
for $currentItemName in name() return instance('types')/types/type[@typeID = $currentItemName]/label
Also, relying on the name() function can be dangerous, as it returns the lexical form of a QName, that is: prefix:local-name. Different authors can choose different prefixes but map them to the same namespace URI, so in general it is better to rely on local-name() and namespace-uri().
Alex
I have a situation where I get the label of an item in an itemset from a different instance. I do this all over the place w/ repeats, and keep the name() as a variable to use to do the look up in my xpath [id = $name] kinda thing. I can't seem to figure out a way to do this with an itemset in a select1. Or is there a way to generate an set of items for use in a select1 using a repeat?
I've included an example of what I'm trying to do, I know it won't work, but will give you an idea of what I'm trying to accomplish. Thanks for any help.
<xforms:itemset nodeset="instance('view')/template-view/query/*[1]/*">
<xforms:variable name="currentItemName" select="name()"/>
<xforms:label ref="xxforms:attribute(name(),instance('types')/types/type[@typeID = $currentItemName]/label)"/>
<xforms:value ref="xxforms:attribute(name(),name())"/>
</xforms:itemset>
--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
You receive this message as a subscriber of the
[hidden email] mailing list.
To unsubscribe: mailto:
[hidden email]
For general help: mailto:
[hidden email]?subject=help
OW2 mailing lists service home page:
http://www.ow2.org/wws