Oct 5th, 2006, 07:30 PM
Using XSL; Binding arrays, indexing from 1 instead of 0?
I'm using the XSTL view resolver in my pages. One of the niggles I have with it so far (not necessarily Spring's fault) is that XSL starts indexing sets of things at 1 instead of 0. So, I end up with code like this in my stylesheet:
<xsl:with-param name="rowName" select="'Physical Address 1'"/>
<xsl:with-param name="formPath" select="'physicalAddress.addressLine'"/>
<xsl:with-param name="value" select="/model/buyer/physicalAddress/addressLine"/>
This is a call to an xsl template which renders (among other things) a form <input...> field; formPath is pushed into the "name" attribute, and is the spring expression used to bind to the bean, while value is pushed into the "value" attribute, and is the xpath expression used to pull the value out of the xml model that's being transformed. As you can see, in the spring variant, we're addressing element 0, while in the xml variant element 1.
Can you think of a (not too nasty) workaround so that I can keep these is check with each other? I can foresee that building the app out with this inconsistency could be messy.