RE: How to cast current-group() ?
> the type of current-group() and current-grouping-key() is > item()* and xs:anyAtomicType?. I wonder how to cast them to > what really is in them. > > <xsl:for-each-group select="/results/match" group-by="team"> > <xsl:copy-of > select="myfn:MakeTableRow(current-grouping- > key(),current-group())"/> > </xsl:for-each-group> > > In my example, the function myfh:MakeTabelRow(.,.) takes the > parameters as="element(*,my:matchType)*" and as="schema- > element(my:team)" respectively both complexTypes. My > workaround is to leave the function parameters untyped, not > really ingenious... > current-grouping-key() is an atomic value, not an element. You could construct an element and give it a type by validating it, but I suspect that's not what you want to do. I would suggest: <xsl:copy-of select="myfn:MakeTableRow(current-group()/team, current-group())"/> though I can't see enough of your code to know whether that will fix the problem. Note that unless you're using an XSLT 2.0 processor that does strict static typing, which is unlikely, as I don't think one exists and I don't think anyone would be foolish enough to write one, it doesn't matter that the static type of current-group() is item()* - it's the dynamic type that matters, and so long as /results/match selects elements that have been validated against the schema type my:matchType, the function call should work. I think it's failing on the first argument, not the second, though you don't show any error messages. Michael Kay http://www.saxonica.com/
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format