- From: Norm Tovey-Walsh <ndw@nwalsh.com>
- Date: Wed, 08 Jan 2025 13:41:29 +0000
- To: <denis.maier@unibe.ch>
- Cc: <xproc-dev@w3.org>
<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{http://www.w3.org/1999/xhtml}div" (or wrapper="Q{{http://www.w3.org/1999/xhtml}}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://norm.tovey-walsh.com/ > Two paradoxes are better than one; they may even suggest a > solution.--Edward Teller
Received on Wednesday, 8 January 2025 13:41:37 UTC