Re: Namespaces in xproc

On 08/01/2025 14:15, denis.maier@unibe.ch wrote:
>
> Hi,
>
> In my pipeline I have an xproc step that should wrap all adjacent
> elements with a given class in a div.
>
> <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….
>
> 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.
>

I would try

   <p:wrap xmlns="http://www.w3.org/1999/xhtml" wrapper="div" ...>

but I haven't tested that.

Received on Wednesday, 8 January 2025 13:22:15 UTC