- From: <denis.maier@unibe.ch>
- Date: Thu, 9 Jan 2025 14:26:02 +0000
- To: <ndw@nwalsh.com>
- CC: <xproc-dev@w3.org>
Thanks, this worked: <p:wrap match="xhtml:p[@class='reflist-item']" wrapper="Q{{http://www.w3.org/1999/xhtml}}div" group-adjacent="@class"/> But now I also need to add an attribute to the div. Is that possible in one go using @wrapper? Or do I have to use another step for this? (The problem here is that matching on all divs wouldn't work.) > -----Ursprüngliche Nachricht----- > Von: Norm Tovey-Walsh <ndw@nwalsh.com> > Gesendet: Mittwoch, 8. Januar 2025 14:41 > An: Maier, Denis Christian (UB) <denis.maier@unibe.ch> > Cc: xproc-dev@w3.org > Betreff: Re: Namespaces in xproc > > <denis.maier@unibe.ch> writes: > > <p:wrap match="xhtml:p[@class='reflist-item']" wrapper="xhtml:div" > > group-adjacent="@class"/> > > > > First, this works but it feels a bit cumbersome as I need to supply the > grouping information twice, once in @match then in @group-adjacent. Maybe > there's a better way, but anyway.. > > If you only want to wrap adjacent 'p' elements that have that class (and you > have other 'p' elements that don't have that class), I don't think you can do > better. Maybe it feels like repetition, but @match and @group-adjacent are > serving very different purposes. > > > Now to my real question: I don't quite understand how namespaces are > handled here. I need the namespace prefix when matching, but how can I > write a simple div element in the xhtml namespace? If I use the prefix, it will > write out the prefix as well, if I omit the prefix it will add an empty namespace > declaration. > > Managing the serialization of namespaces is sometimes a bit tricky. Curiously, I > can't think of an easy way to take a document that uses multiple different > prefixes and "normalize" to a single set of prefixes (including the default > namespace). Maybe we need one of those? Or maybe I'm just having a brain > cramp. > > XProc follows the XPath/XSLT convention that a name without a colon is in no > namespace. The following will work, but it may not seem very intuitive at first: > > > wrapper="Q{https://eur03.safelinks.protection.outlook.com/?url=http%3A% > 2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C02%7Cdenis.maier%40 > unibe.ch%7C93b2ab9c5b514ca5eb2308dd2fea3b5e%7Cd400387a212f43ea > ac7f77aa12d7977e%7C1%7C0%7C638719405524554514%7CUnknown%7 > CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOi > JXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C80000%7C%7C%7C&s > data=3YgqaTe3tmecQfi6YubZH2%2BbmAmRXOO28YdnC%2BvM9Ao%3D&re > served=0}div" > > (or > wrapper="Q{{https://eur03.safelinks.protection.outlook.com/?url=http%3A > %2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C02%7Cdenis.maier%4 > 0unibe.ch%7C93b2ab9c5b514ca5eb2308dd2fea3b5e%7Cd400387a212f43 > eaac7f77aa12d7977e%7C1%7C0%7C638719405524571494%7CUnknown > %7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIl > AiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C80000%7C%7C%7 > C&sdata=Apn%2B1D%2BYkLTMLdaVaxepT6s2WdIU9j42n%2BeeO33cR00%3 > D&reserved=0}}div" if expand-text is true.) > > That's an EQName and it's a way to represent a namespace qualified name > without a prefix. > > Be seeing you, > norm > > -- > Norm Tovey-Walsh <ndw@nwalsh.com> > https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fnorm > .tovey- > walsh.com%2F&data=05%7C02%7Cdenis.maier%40unibe.ch%7C93b2ab9c5 > b514ca5eb2308dd2fea3b5e%7Cd400387a212f43eaac7f77aa12d7977e%7C > 1%7C0%7C638719405524584173%7CUnknown%7CTWFpbGZsb3d8eyJFbX > B0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWF > pbCIsIldUIjoyfQ%3D%3D%7C80000%7C%7C%7C&sdata=4SHmuCll1RhJMXrs > 2E8oa%2FuKod0WB4CpwrXIUtPi2ao%3D&reserved=0 > > > Two paradoxes are better than one; they may even suggest a > > solution.--Edward Teller
Received on Thursday, 9 January 2025 14:26:09 UTC