Subject: Re: [xsl] XSLT 2.0 & Grouping for-each-group - RESEND From: Mark Brand <mark.brand@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 07 Aug 2003 19:41:29 +1000 |
* Micheal Kay <snip> But I may have misunderstood the requirement. What do you want to happen if there isn't a DIVISION item in the group? </snip>
<PART> <DIVISION> <NOTE/> <REGULATION> <NOTE/> </REGULATION> </DIVISION> </PART>
<PART> <DIVISION> <NOTE/> <REGULATION> <NOTE/> </REGULATION> </DIVISION> </PART>
* Mark Brand
Hi
I have further questions on the fragments posted earlier. I did try implementing both options but had some questions ...
Q1. <snip>
<xsl:for-each-group select="current-group() except "." group-starting-with="*[@StyleName='DIVISION']">
</snip>
With this line of code, i found that it would execute (enter the for-each-group
loop) even if there wasn't a DIVISION item in the group. How do I stop the loop being entered if the group-starting-with entry is not in the list. I have tried an if statement after the loop has been entered but it is too late then for my purposes.
This reads to me like
<xsl:if test="current-group()/*[@StyleName='DIVISION']">
<xsl:for-each-group select="current-group() except "." group-starting-with="*[@StyleName='DIVISION']">
...
</xsl:if>
But I may have misunderstood the requirement. What do you want to happen if there isn't a DIVISION item in the group?
Q2. <snip>
<Part Category="{@StyleName}">
<xsl:copy-of select="child::node()"/>
<xsl:for-each-group select="current-group() except ."
group-starting-with="*[@StyleName=f:child(@StyleName)]">
<xsl:apply-templates select="."/>
</snip>
With this piece of code from the second option where would you put the closing tags, where-ever i put them they would all output after everything else instead of in a nested fashion.
Clearly the XSLT must be well-formed XML, so the closing tags have to be properly nested, and they will then also be properly nested in the result document. In fact, it's impossible to output a document in which the tags aren't properly nested! So I don't think I understand the question.
Michael Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XSLT 2.0 & Grouping for-, Michael Kay | Thread | RE: [xsl] XSLT 2.0 & Grouping for-, Michael Kay |
[xsl] two column table with alterna, nicholse | Date | Re: [xsl] XSLT 2.0 & Grouping for-, Mark Brand |
Month |