Subject: Re: [xsl] Including precediing-siblings with the first group From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 18 Aug 2022 14:56:48 -0000 |
Am 18.08.2022 um 16:27 schrieb rick@xxxxxxxxxxxxxx: > > > I have an input file that I want to split into files at each section. > The first section should include everything before it. Below are my > input, desired output, and stylesheet. I am pretty sure this is the > simplest approach, but any suggestions would be appreciated. > > Rick > > <?xml version="1.0" encoding="UTF-8"?> > > <chapter id="Assault_gd1g1l1027760"> > > B B B <title>Transferred Intent</title> > > B B B <toc/> > > B B B <para/> > > B B B <section id="GI_gd1g1o1030579"> > > B B B B B B B <title>General Comments</title> > > B B B B B B B <para>General comments here</para> > > B B B </section> > > B B B <section id="GI_gd1g1p1030593"> > > <title>InstructionbTransferred IntentbDifferent Offense</title> > > B B B B B B B <para>Instructions here</para> > > B B B </section> > > B B B <section id="GI_gd1g1q1030657"> > > <title>InstructionbTransferred IntentbDifferent Person or > Propertyo?=</title> > > B B B B B B B <para>More instructions here</para> > > B B B </section> > > </chapter> > Is the content of chapter always some unknown elements plus a sequence of section elements? In that case you could of course also simply map section to file elements with e.g. B <xsl:template match="section"> B <file> B B B <xsl:copy-of select="."/> B </file> </xsl:template> <xsl:template match="section[1]"> B <file> B B B <xsl:copy-of select="preceding-sibling::*, ."/> B </file> </xsl:template> <xsl:template match="chapter/*[not(self::section)]"/>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Including precediing-siblings, rick@xxxxxxxxxxxxxx | Thread | Re: [xsl] Including precediing-sibl, rick@xxxxxxxxxxxxxx |
[xsl] Including precediing-siblings, rick@xxxxxxxxxxxxxx | Date | Re: [xsl] Including precediing-sibl, rick@xxxxxxxxxxxxxx |
Month |