Altova Mailing List Archives


[xsl] Re: using OR in a group-ending-with test

From: Jeff Wilson <jeffrey@----------------.--->
To: xsl-list@-----.------------.---
Date: 8/16/2011 9:43:00 AM
Good morning,

It seems that xsl:for-each-group may not be the correct way to go  
about what I'm trying to do. All I need to do is nest adjacent paras  
styled with "Feature..." in a new element.

Would it be easier to test the following-sibling's value to determine  
when to end the nesting element? Or is grouping the correct logic?

Given (simplified):

<w:p><w:pPr><w:pStyle @w:val="Para"></w:pPr></w:p>
<w:p><w:pPr><w:pStyle @w:val="Para"></w:pPr></w:p>
<w:p><w:pPr><w:pStyle @w:val="FeatureType"></w:pPr></w:p>
<w:p><w:pPr><w:pStyle @w:val="FeatureTitle"></w:pPr></w:p>
<w:p><w:pPr><w:pStyle @w:val="FeaturePara"></w:pPr></w:p>
<w:p><w:pPr><w:pStyle @w:val="FeaturePara"></w:pPr></w:p>
<w:p><w:pPr><w:pStyle @w:val="FeatureSlug"></w:pPr></w:p>
<w:p><w:pPr><w:pStyle @w:val="FeatureList"></w:pPr></w:p>
<w:p><w:pPr><w:pStyle @w:val="FeatureList"></w:pPr></w:p>
<w:p><w:pPr><w:pStyle @w:val="FeatureList"></w:pPr></w:p>
<w:p><w:pPr><w:pStyle @w:val="FeaturePara"></w:pPr></w:p>
<w:p><w:pPr><w:pStyle @w:val="Para"></w:pPr></w:p>
<w:p><w:pPr><w:pStyle @w:val="H1"></w:pPr></w:p>

I would like to end up with (simplified):

<Para>...</Para>
<Para>...</Para>
<AnchoredFeature>
<FeatureTitle>...</FeatureTitle>
<FeaturePara>...</FeaturePara>
<FeaturePara>...</FeaturePara>
<img src="...">
<FeatureList>...</FeatureList>
<FeatureList>...</FeatureList>
<FeatureList>...</FeatureList>
<FeaturePara>...</FeaturePara>
</AnchoredFeature>
<Para>...</Para>
<H1>...</H1>

I've tried many permutations of the select and group-by, group- 
adjacent, group-starting-with and group-ending-with to varying  
degrees of success. But it seems to me after much trial and error,  
that I might just be barking up the wrong tree.

Thanks to all who've responded, you're kindness is deeply appreciated.

Jeff

On Aug 15, 2011, at 12:51 PM, Jeff Wilson wrote:

> Good afternoon,
>
> I'm trying to get a group to end with either of two conditions.
>
> This is the current group test:
>
> <xsl:for-each-group select="following-sibling::w:p/w:pPr/w:pStyle/ 
> @w:val[starts-with(.,'Feature')]/ancestor::w:p" group-ending- 
> with="w:p/w:pPr/w:pStyle/@w:val[not(starts-with(.,'Feature')) or  
> 'FeatureType']">
>
> The resulting xml runs includes every following-sibling in the  
> document, so I assume (and may be incorrect) that the problem is  
> with my ending-with test.
>


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@l...>
--~--

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.