Subject: Re: [xsl] Process the following group From: "Eliot Kimber eliot.kimber@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 7 Jul 2022 22:10:24 -0000 |
So the first two div2 elements should be grouped with the first div1? If you do group-starting-with div1 then the first two div2s will be in the first group and that group will not start with a div1, so you can have logic to ignore that first group and then in a group that starts with <div1>, you can pull any <div2> elements that do not have a <div1> preceding sibling, which will get the <div2>s that would have formed the first group. No subsequent group will have <div2>s that do not have a <div1> preceding sibling. But this is also a case where it might be easier to pre-process your content before grouping, for example, to move things so that theres always a <div1> before any <div2>s or what ever it might be. I generally find these kinds of challenges are most effectively solved by breaking them into several steps, each one of which is relatively easy to implement. Cheers, E. _____________________________________________ Eliot Kimber Sr Staff Content Engineer O: 512 554 9368 M: 512 554 9368 servicenow.com<https://www.servicenow.com> LinkedIn<https://www.linkedin.com/company/servicenow> | Twitter<https://twitter.com/servicenow> | YouTube<https://www.youtube.com/user/servicenowinc> | Facebook<https://www.facebook.com/servicenow> From: rick@xxxxxxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thursday, July 7, 2022 at 4:49 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Subject: Re: [xsl] Process the following group [External Email] The reason I was looking at this is sometimes the order of the groups changes in the output. So, if I have this: <?xml version="1.0" encoding="UTF-8"?> <root> <div2/> <div2/> <div1/> <div1/> <div2/> <div2/> <div1/> </root> I sometimes need this: <?xml version="1.0" encoding="UTF-8"?> <root> <div1> <div2/> <div2/> </div1> <div1> <div2/> <div2/> </div1> <div1/> </root> In other words, in the final output, any non-div1 elements have to be included in the first div1 to make the output document valid. Rick XSL-List info and archive<https://urldefense.com/v3/__http:/www.mulberrytech.com/xsl/xsl-list__ ;!!N4vogdjhuJM!ETXjA_pkanV4YuUlM2t4byaLEcmkOMaAOCPd8Cj-ETgFeVEc8da9KunXFIGyyG UVz3PHk2jpPV1xFA7i6U9G5sH6hYe2lu8MPk1IOa5fH5Y$> EasyUnsubscribe<https://urldefense.com/v3/__http:/lists.mulberrytech.com/unsu b/xsl-list/3453418__;!!N4vogdjhuJM!ETXjA_pkanV4YuUlM2t4byaLEcmkOMaAOCPd8Cj-ET gFeVEc8da9KunXFIGyyGUVz3PHk2jpPV1xFA7i6U9G5sH6hYe2lu8MPk1ITrxblJQ$> (by email<>)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Process the following gro, rick@xxxxxxxxxxxxxx | Thread | Re: [xsl] Process the following gro, rick@xxxxxxxxxxxxxx |
Re: [xsl] Process the following gro, rick@xxxxxxxxxxxxxx | Date | Re: [xsl] XPath expression to conve, Dimitre Novatchev dn |
Month |