Thread: [Xsltforms-support] id in repeat
Brought to you by:
alain-couthures
From: Christopher D. <cd...@vi...> - 2010-03-20 09:08:31
|
I have two nested repeats and I need to get the current index of the inner repeat using the index() function. Here is an example: <xf:repeat id="outerRepeat" nodeset="outer"> <xf:repeat id="innerRepeat" nodeset="inner"> ... </xf:repeat> </xf:repeat> The index() function works well so long as there is only element in the "outer" nodeset. However, if there is more than one element in the outer nodeset, the index() function gives incorrect results. Chris |
From: COUTHURES A. <ala...@ag...> - 2010-03-20 09:21:55
|
Christopher, Can you please post a testcase about this bug? Thanks! -Alain > I have two nested repeats and I need to get the current index of the > inner repeat using the index() function. Here is an example: > > <xf:repeat id="outerRepeat" nodeset="outer"> > <xf:repeat id="innerRepeat" nodeset="inner"> > ... > </xf:repeat> > </xf:repeat> > > The index() function works well so long as there is only element in > the "outer" nodeset. However, if there is more than one element in > the outer nodeset, the index() function gives incorrect results. > > Chris > > ------------------------------------------------------------------------------ > > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support > > > |
From: Christopher D. <cd...@vi...> - 2010-03-20 09:56:44
|
Alain, Here is a simple example which demonstrates the behavior. Chris <?xml version="1.0" ?> <?xml-stylesheet href="xsltforms.xsl" type="text/xsl"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <head> <xf:model> <!-- DATA FROM EXTERNAL SOURCES --> <xf:instance id="library"> <library> <books> <book> <title>The Way We Work</title> <authors> <author>David Macaulay</author> <author>Richard Walker</author> </authors> </book> <book> <title>The Astonishing Life of Octavian Nothing, Traitor to the Nation, Volume II: The Kingdom on the Waves</title> <authors> <author>M. T. Anderson</author> </authors> </book> <book> <title>Old Bear</title> <authors> <author>Kevin Henkes</author> </authors> </book> </books> </library> </xf:instance> </xf:model> <title>index() Test</title> <style> td { border: 1px solid #000000; } </style> </head> <body> <xf:group ref="instance('library')"> Click a book or author for its index <table> <thead> <tr> <td> <b>Title</b> </td> <td> <b>Authors</b> </td> </tr> </thead> <tbody> <xf:repeat id="books" nodeset="books/book"> <td> <xf:trigger appearance="minimal"> <xf:label> <xf:output ref="title"/> </xf:label> <xf:message ev:event="DOMActivate"> <xf:output value="concat('The current book is: ', instance('library')/books/book[index('books')]/title)"/> </xf:message> </xf:trigger> </td> <td> <table> <xf:repeat id="authors" nodeset="authors/author"> <td> <xf:trigger appearance="minimal"> <xf:label> <xf:output ref="."/> </xf:label> <xf:message ev:event="DOMActivate"> <xf:output value="concat('The current author is: ', instance('library')/books/book[index('books')]/authors/author[index('authors')])"/> </xf:message> </xf:trigger> </td> </xf:repeat> </table> </td> </xf:repeat> </tbody> </table> </xf:group> </body> </html> |
From: COUTHURES A. <ala...@fr...> - 2010-03-20 09:24:36
|
Christopher, Can you please post a testcase about this bug? Thanks! -Alain > I have two nested repeats and I need to get the current index of the inner repeat using the index() function. Here is an example: > > <xf:repeat id="outerRepeat" nodeset="outer"> > <xf:repeat id="innerRepeat" nodeset="inner"> > ... > </xf:repeat> > </xf:repeat> > > The index() function works well so long as there is only element in the "outer" nodeset. However, if there is more than one element in the outer nodeset, the index() function gives incorrect results. > > Chris > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support > > > |
From: COUTHURES A. <ala...@ag...> - 2010-03-27 22:53:38
|
Chris, > I have two nested repeats and I need to get the current index of the inner repeat using the index() function. Here is an example: > > <xf:repeat id="outerRepeat" nodeset="outer"> > <xf:repeat id="innerRepeat" nodeset="inner"> > ... > </xf:repeat> > </xf:repeat> > > The index() function works well so long as there is only element in the "outer" nodeset. However, if there is more than one element in the outer nodeset, the index() function gives incorrect results. > This bug appears only with IE because of its different event management... I have fixed this but an extra HTML is still required: you have to embed the nested xf:repeat within a TBODY element. Thank you for your feedbacks! -Alain |