Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed to remove Note: from the start of a string using XSLT
    primarykey
    data
    text
    <p>I have been tasked with styling XML and so far nearly all of the tags I have been given are either p or ph which just display the contents of the tag on screen and I can style as required</p> <p>eg:</p> <pre><code>&lt;p outputclass="LC AStatProv"&gt;Council Regulation (EC) No 2201/2003 of 27 November 2003 Concerning Jurisdiction and the Recognition and Enforcement of Judgments in Matrimonial Matters and in Matters of Parental Responsibility, repealing Regulation (EC) No 1347/2000 (Brussels II Revised) (2003) OJ L 338/1, Art&amp;#x00A0;20&lt;/p&gt; </code></pre> <p>will display as:</p> Council Regulation (EC) No 2201/2003 of 27 November 2003 Concerning Jurisdiction and the Recognition and Enforcement of Judgments in Matrimonial Matters and in Matters of Parental Responsibility, repealing Regulation (EC) No 1347/2000 (Brussels II Revised) (2003) OJ L 338/1, Art&#x00A0;20</p> <p>Today I have noticed that a new <strong>note</strong> tag has been used and this is causing "Note: " to be prepended to the beginning of each string eg:</p> <pre><code>&lt;p outputclass="LC ACourt"&gt;&lt;note outputclass="CaseSearchCourt"&gt;Court of Appeal&lt;/note&gt;&lt;/p&gt; </code></pre> <p>will display as:</p> <p>Note: Re A (Abduction: Interim Directions: Accommodation by Local Authority) [2010] EWCA Civ 586 [2011] 1 FLR 1</p> <p>The FO produced for this is:</p> <pre><code>&lt;fo:block&gt;&lt;fo:inline font-weight="bold" border-right-width="0pt" border-left-width="0pt"&gt;Note: &lt;/fo:inline&gt; Court of Appeal&lt;/fo:block&gt; </code></pre> <p>I have tried the following code gleaned from elsewhere on this site but it didn't remove the string I wanted:</p> <pre><code>&lt;xsl:template match="note"&gt; &lt;note&gt; &lt;xsl:if test="contains(., 'Note:')"&gt; &lt;xsl:call-template name="remove"&gt; &lt;xsl:with-param name="value" select="."/&gt; &lt;/xsl:call-template&gt; &lt;/xsl:if&gt; &lt;/note&gt; &lt;/xsl:template&gt; &lt;xsl:template name="remove"&gt; &lt;xsl:param name="value"/&gt; &lt;xsl:value-of select="concat(substring-before($value, 'Note:'), substring-after($value, 'Note:'))"/&gt; &lt;/xsl:template&gt; </code></pre> <p>I have tried to see where XSLT gets the "Note: " from but can't find it anywhere so my next thought is to try and pattern match the string and remove "Note: " from the beginning of the string. Is this a good way to go about this and how would I do this?</p> <p>thanks.</p> <p><strong>EDIT: Just to summarise my rambling and confusing question.</strong></p> <p>Where it renders: </p> <p>Note: Re A (Abduction: Interim Directions: Accommodation by Local Authority) [2010] EWCA Civ 586 [2011] 1 FLR 1</p> <p>I just want it to render:</p> <p>Re A (Abduction: Interim Directions: Accommodation by Local Authority) [2010] EWCA Civ 586 [2011] 1 FLR 1</p> <p><strong>EDIT 2 and the answer</strong></p> <p>My initial investigations were based upon grepping for Note: which wasn't being found. I have though found the following:</p> <pre><code>&lt;xsl:template match="*[contains(@class,' topic/note ')]"&gt; </code></pre> <p>and then commented out the following lines:</p> <pre><code>&lt;!--&lt;xsl:text&gt;Note&lt;/xsl:text&gt;--&gt; &lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt; &lt;!--&lt;xsl:text&gt;: &lt;/xsl:text&gt;--&gt; &lt;/fo:inline&gt; &lt;xsl:text&gt; &lt;/xsl:text&gt; &lt;xsl:apply-templates/&gt; </code></pre> <p>And I have got rid of the "Note: ".</p> <p><strong>EDIT 3:</strong></p> <p>This didn't actually work as it created an opening block but didn't close it so I ended up removing the entire <code>&lt;xsl:template match="*[contains(@class,' topic/note ')]"&gt;</code> as we have no need for any type of notes in our system</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload