RE: [xsl] Find the string and apply the tag

Subject: RE: [xsl] Find the string and apply the tag
From: Hermann Stamm-Wilbrandt <STAMMW@xxxxxxxxxx>
Date: Thu, 24 Dec 2009 00:51:43 +0100
Selva,

- you already got a XSLT 2.0 solution
- you want to use it in IE which supports XSLT 1.0, only
- even a XSLT 1.0 solution with regexp:replace() extension function
  [ http://exslt.org/regexp/functions/replace/index.html ] would not help
  you since regexp:replace() is not supported by IE.

So this is not a pure XSLT solution, but maybe your only choice.
It is restricted to IE, though.
You can implement the extension function you need yourself
with msxsl, take this as an example:
http://stamm-wilbrandt.de/en/xsl-list/xsl-url/msgeturl/
(it provides access to the URL for a XML document executing
a stylesheet by <?xml-stylesheet>)


Mit besten Gruessen / Best wishes,

Hermann Stamm-Wilbrandt
Developer, XML Compiler
WebSphere DataPower SOA Appliances


             "Selvaganesh"
             <selvaganesh_t@ho
             vservices.in>                                              To
                                       <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
             12/23/2009 02:56                                           cc
             PM
                                                                   Subject
                                       RE: [xsl] Find the string and apply
             Please respond to         the tag
             xsl-list@xxxxxxxx
              lberrytech.com








So XSLT 1.0 does not support the xsl:analyze-string function am correct ?

-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
Sent: Wednesday, December 23, 2009 7:15 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Find the string and apply the tag

> Can I use below XSL coding for IE viewing purpose? It will be
> working or the coding working only Saxon processer.

It requires a processor that supports XSLT 2.0. The processor in IE only
supports XSLT 1.0.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay
>
> Thanks,
> Selva
>
> -----Original Message-----
> From: Imsieke, Gerrit, le-tex [mailto:gerrit.imsieke@xxxxxxxxx]
> Sent: Wednesday, December 23, 2009 6:24 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Find the string and apply the tag
>
> Dear Selva,
>
> xsl:analyze-string should do the trick.
>
> flags="s" is for multiline input (treat newline as ordinary
> character).
>
> The rules where to add boldface, i.e., the regex, might get
> somewhat complex when you try to capture all real-life cases.
> The 'x' flag will help you writing a more readable regex
> then. See http://www.w3.org/TR/xpath-functions/#flags
>
> Things will get complicated though if some markup inside
> <derivation> has to survive. There's no analyze-string that
> will reproduce elements in the matched substring.
>
>   <xsl:template match="/">
>     <root>
>       <xsl:apply-templates select="derivations/derivation"
> mode="boldify"/>
>     </root>
>   </xsl:template>
>
>   <xsl:template match="derivation" mode="boldify">
>     <xsl:copy>
>       <xsl:analyze-string select="."
>         regex="(
>                  replaces?
>                  | was[ ]created[ ]in.+
>                )"
>         flags="sx">
>         <xsl:matching-substring>
>           <b>
>             <xsl:value-of select="."/>
>           </b>
>         </xsl:matching-substring>
>         <xsl:non-matching-substring>
>           <xsl:value-of select="."/>
>         </xsl:non-matching-substring>
>       </xsl:analyze-string>
>     </xsl:copy>
>   </xsl:template>
>
> Gerrit
>
>
> Selvaganesh schrieb:
> > Hi Team,
> >
> > Am new in the XSLT regex part, kindly help me, how can I find the
> > string
> and
> > apply the tag.
> >
> > Input file:
> > <derivations id="Section 111">
> > <derivation>Subsection (1) was created in drafting (i.e.
> added by the
> > drafter of the consolidation and not found in the earlier
> > legislation)</derivation>.
> > <derivation>Subsection (2) replaces <sccc:legis-cite
> > sccc:title="Income
> and
> > Corporation Taxes Act" sccc:year="1988" sccc:chapter="1"
> sccc:section="root"
> > sccc:type="statute">Income and Corporation Taxes Act
> 1988</sccc:legis-cite>
> > <sccc:legis-cite sccc:title="Income and Corporation Taxes Act"
> > sccc:year="1988" sccc:chapter="1" sccc:section=""
> sccc:type="statute">Sch.5
> > para.8(6).</sccc:legis-cite></derivation>
> > <derivation>Subsection (3) replaces <sccc:legis-cite
> > sccc:title="Income
> and
> > Corporation Taxes Act" sccc:year="1988" sccc:chapter="1"
> sccc:section="root"
> > sccc:type="statute">Income and Corporation Taxes Act
> 1988</sccc:legis-cite>
> > <sccc:legis-cite sccc:title="Income and Corporation Taxes Act"
> > sccc:year="1988" sccc:chapter="1" sccc:section=""
> sccc:type="statute">Sch.5
> > para.3(12).</sccc:legis-cite></derivation>
> > <derivation>Subsection (3) replace <sccc:legis-cite
> sccc:title="Income
> > and Corporation Taxes Act" sccc:year="1988" sccc:chapter="1"
> sccc:section="root"
> > sccc:type="statute">Income and Corporation Taxes Act
> 1988</sccc:legis-cite>
> > <sccc:legis-cite sccc:title="Income and Corporation Taxes Act"
> > sccc:year="1988" sccc:chapter="1" sccc:section=""
> sccc:type="statute">Sch.5
> > para.3(12).</sccc:legis-cite></derivation>
> > </derivations>
> >
> > Expected Output:
> >
> > <root>
> > <p>Subsection (1) <b>was created in drafting (i.e. added by the
> > drafter of the consolidation and not found in the earlier
> > legislation)</b>.</p> <p>Subsection (2) <b>replaces</b> Income and
> > Corporation Taxes Act
> 1988Sch.5
> > para.8(6).</p>
> > <p>Subsection (3) <b>replace</b> Income and Corporation Taxes Act
> 1988Sch.5
> > para.3(12).</p>
> > </root>
> >
> > Thanks to everyone,
> > Selva
> >
> >
> >
> > Confidentiality Notice:  This transmittal is a confidential
> communication.
> If you are not the intended recipient, you are hereby
> notified that you have received this transmittal in error and
> that any review, dissemination, distribution or copying of
> this transmittal is strictly prohibited.  If you have
> received this communication in error, please notify this
> office immediately by reply and immediately delete this
> message and all of its attachments, if any.
> >
>
> --
> Gerrit Imsieke
> Geschdftsf|hrer / Managing Director
> le-tex publishing services GmbH
> Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341
> 355356 110, Fax +49 341 355356 510 gerrit.imsieke@xxxxxxxxx,
> http://www.le-tex.de
>
> Registergericht / Commercial Register: Amtsgericht Leipzig
> Registernummer / Registration Number: HRB 24930
>
> Geschdftsf|hrer: Gerrit Imsieke, Svea Jelonek, Thomas
> Schmidt, Dr. Reinhard Vvckler
>
>
>
> Confidentiality Notice:  This transmittal is a confidential
> communication.  If you are not the intended recipient, you
> are hereby notified that you have received this transmittal
> in error and that any review, dissemination, distribution or
> copying of this transmittal is strictly prohibited.  If you
> have received this communication in error, please notify this
> office immediately by reply and immediately delete this
> message and all of its attachments, if any.



Confidentiality Notice:  This transmittal is a confidential communication.
If you are not the intended recipient, you are hereby notified that you
have received this transmittal in error and that any review, dissemination,
distribution or copying of this transmittal is strictly prohibited.  If you
have received this communication in error, please notify this office
immediately by reply and immediately delete this message and all of its
attachments, if any.

Current Thread