RE: [xsl] using identity transform to change <p /> into <p>text</p>

Subject: RE: [xsl] using identity transform to change <p /> into <p>text</p>
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Wed, 8 May 2002 15:31:10 +0100
Depending on the exact details of your source document, you might be able to
do this with

<xsl:template match="section/text()">
  <p><xsl:copy-of select="."/></p>
</xsl:template>

<xsl:template match="section/p[not(node())]"/>

<xsl:template match="p">
<xsl:copy-of select="."/>
</xsl:template>

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Zack Brown
> Sent: 08 May 2002 15:03
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] using identity transform to change <p /> into
> <p>text</p>
>
>
> Hi folks,
>
> I have a bunch of files with the following form:
>
> --------------------------------------------------------------
> <section>
>
> first paragraph.
>
> <p />
>
> second paragraph.
>
> <p />
>
> third paragraph.
>
> <p />
>
> fourth paragraph.
>
> </section>
>
> <section>
>
> <p>paragraph not to change</p>
>
> <p>another good paragraph</p>
>
> </section>
> --------------------------------------------------------------
>
> Is there a way to use the identity transform (or anything else) to
> change that to
>
> --------------------------------------------------------------
> <section>
>
> <p>first paragraph.</p>
>
> <p>second paragraph.</p>
>
> <p>third paragraph.</p>
>
> <p>fourth paragraph.</p>
>
> </section>
>
> <section>
>
> <p>paragraph not to change</p>
>
> <p>another good paragraph</p>
>
> </section>
> --------------------------------------------------------------
>
> Thanks,
> Zack
>
> --
> Zack Brown
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread