Subject: RE: [xsl] How to cast current-group() ? From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Mon, 27 Apr 2009 21:30:47 +0100 |
> 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()[1]/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/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] How to cast current-group() ?, Leo Studer | Thread | Re: [xsl] How to cast current-group, Studer Leo |
[xsl] How to cast current-group() ?, Leo Studer | Date | Re: [xsl] enclosing attribute in si, Wendell Piez |
Month |