|
Subject: Re: [xsl] Process an element once From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 16 Oct 2026 21:28:46 -0000 |
On 16/10/2026 23:11, rick@xxxxxxxxxxxxxx wrote: > > I have this XML: > > <root> > > B B B <x>not a child of p</x> > > B B B <p>1</p> > > B B B <p>2</p> > > B B B <p>3</p> > > B B B <x>child of p</x> > > B B B <p>4</p> > > </root> > > If an <x> element immediately follows a <p>, I want to make it a child > of the <p>: > > <root> > B B <x>not a child of p</x> > B B <p>1</p> > B B <p>2</p> > B B <p> > B B B B B <x>child of p</x>3</p> > B B B <p>4</p> > </root> > Or as another option B <xsl:mode on-no-match="shallow-copy"/> B <xsl:template match="p[following-sibling::*[1][self::x]]"> B B <xsl:copy> B B B <xsl:copy-of select="following-sibling::*[1], node()"/> B B </xsl:copy> B </xsl:template> B <xsl:template match="x[preceding-sibling::*[1][self::p]]"/>
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Process an element once, Bauman, Syd s.bauman | Thread | Re: [xsl] Process an element once, rick@xxxxxxxxxxxxxx |
| Re: [xsl] Process an element once, Bauman, Syd s.bauman | Date | Re: [xsl] Process an element once, rick@xxxxxxxxxxxxxx |
| Month |