Re: [xsl] List Item Content

Subject: Re: [xsl] List Item Content
From: "Bauman, Syd s.bauman@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 23 Apr 2024 13:46:03 -0000
I do not think this is what you really want, because I cannot pretend to
actually understand what you are trying to do. While there are probably better
ways to do this, the following does take the posted input and generate the
desired output. Maybe you can tweak it into what you really need.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="3.0">

  <xsl:output method="xml" indent="no"/>
  <xsl:mode on-no-match="shallow-copy"/>

  <xsl:template match="div">
    <xsl:copy>
      <xsl:apply-templates select="@*"/>
      <xsl:apply-templates select="p[ @class eq 'BodyText']"/>
      <xsl:apply-templates select="p[ @class eq 'ListParagraph'][ not(
matches( normalize-space(.), '^[0-9]') )]"/>
      <xsl:apply-templates select="p[ @class eq 'ListParagraph'][
matches( normalize-space(.), '^[0-9]')  ]">
        <xsl:sort select="normalize-space(.)"/>
      </xsl:apply-templates>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="p[ @class eq 'BodyText']">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="sup">
    <xsl:variable name="me" select="normalize-space(.)"/>
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
    <xsl:apply-templates select="../following-sibling::p[ sup[
normalize-space(.) eq $me ] ]"/>
  </xsl:template>

</xsl:stylesheet>


________________________________
From: Byomokesh Sahoo sahoo.byomokesh@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, April 23, 2024 04:27
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: [xsl] List Item Content

Hi,

I am getting stuck where the list item comes in any footnote label. Find the
below XML and desired Output.

XML

<div id="1">
<p class="BodyText">Afresh is<sup>1</sup> of the would be<sup>2</sup>.</p>
<p class="ListParagraph">1.   List Here</p>
<p><sup>1</sup> 2 SCC 356</p>
<p><sup>2</sup>Test Here</p>
<p class="ListParagraph">List ietm 1 Text Here</p>
<p class="ListParagraph">List Item 2 Text Here</p>
</div>


OutPut Required:

<div id="1">
<p class="BodyText">Afresh is<sup>1</sup><p><sup>1</sup> 2 SCC 356</p> of the
would be<sup>2</sup><p><sup>5</sup>Test Here</p>
<p class="ListParagraph">List ietm 1 Text Here</p>
<p class="ListParagraph">List Item 2 Text Here</p>.</p>
<p class="ListParagraph">1.  List Here</p>
</div>

Thanks
XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/649132> (by
email<>)

________________________________
From: Byomokesh Sahoo sahoo.byomokesh@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, April 23, 2024 04:27
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: [xsl] List Item Content

Hi,

I am getting stuck where the list item comes in any footnote label. Find the
below XML and desired Output.

XML

<div id="1">
<p class="BodyText">Afresh is<sup>1</sup> of the would be<sup>2</sup>.</p>
<p class="ListParagraph">1.   List Here</p>
<p><sup>1</sup> 2 SCC 356</p>
<p><sup>2</sup>Test Here</p>
<p class="ListParagraph">List ietm 1 Text Here</p>
<p class="ListParagraph">List Item 2 Text Here</p>
</div>


OutPut Required:

<div id="1">
<p class="BodyText">Afresh is<sup>1</sup><p><sup>1</sup> 2 SCC 356</p> of the
would be<sup>2</sup><p><sup>5</sup>Test Here</p>
<p class="ListParagraph">List ietm 1 Text Here</p>
<p class="ListParagraph">List Item 2 Text Here</p>.</p>
<p class="ListParagraph">1.  List Here</p>
</div>

Thanks
XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/649132> (by
email<>)

Current Thread