xsl-list
[Top] [All Lists]

[xsl] Regex and apply xsl number

2008-12-31 04:16:24
Hi,

I am getting problem in regex search in text node. Here my XML

<file xmlns:QL="http://www.xmltricks.com";>
<QL:PARCITE/>
33 C.L.A.S. 505
<QL:QLCITE/>
[1994] O.L.A.A. No. 467
[para1]     The grievance.
[para2]     The grievance.
[para3]     The grievance.
<QL:QLCITE/>
[1994] O.L.A.A. No. 467
[para5]     The grievance. <!-- Need [para4] not [para5] sequence number -->
[para6]     The grievance. <!-- Here should be [para5] -->

<!-- continue like this where [para is found. -->
</file>

Desired Output
=============
<file xmlns:QL="http://www.xmltricks.com";>
<QL:PARCITE/>
33 C.L.A.S. 505
<QL:QLCITE/>
[1994] O.L.A.A. No. 467
[para1]     The grievance.
[para2]     The grievance.
[para3]     The grievance.
<QL:QLCITE/>
[1994] O.L.A.A. No. 467
[para4]     The grievance.
[para5]     The grievance.
</file>

My XSL ==

<xsl:variable name="myregex">((^[)(\w*)(\d*))</xsl:variable>

<xsl:variable name="ss"><xsl:number/></xsl:variable>

<xsl:template match="text()">
  <xsl:analyze-string select="." regex="$myregex">
 <xsl:matching-substring>
<xsl:value-of select="$ss"/>
 </xsl:matching-substring>
 <xsl:non-matching-substring>
  <xsl:value-of select="."/>
 </xsl:non-matching-substring>
</xsl:analyze-string>

===

I want to transform only sequence number (like 1, 2, 3) in [para]
text. I am trying but not able to match and replace to sequence
number.

Thanks
Byomokesh

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>