[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Regex Expression Problem

Subject: Re: Regex Expression Problem
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 24 Jan 2007 12:45:01 +0100
Re:  Regex Expression Problem
Hi Byomokesh,

Try:

<xsl:for-each select="tokenize(P, '&#xA;*')">
   <line>
       <xsl:value-of select="." />
   </line>
</xsl:for-each>

Oh, and you may want to wrap that in another for-each for the stanza:

<xsl:for-each select="tokenize(P, '&#xA;\s*&#xA;\s**')">
   <stanza>
       ... other for-each applied on current node ...
   </stanza>
</xsl:for-each>

Cheers,
-- Abel Braaksma
  http://www.nuntia.nl



Byomokesh wrote:
Hi All,

I am facing Regex problem. Here is my input, output and Stylesheet.

My Input
=======

<P>Todo pasa y todo queda,
pero lo nuestro es pasar,
pasar haciendo caminos,
caminos sobre el mar.
Nunca persequ la gloria,
ni dejar en la memoria
de los hombres mi canci&#243;n;
yo amo los mundos sutiles,
ingrvidos y gentiles,
como pompas de jabn.
</P>


I Need Output
=============

<poem>
<stanza>
<line>Todo pasa y todo queda,</line>
<line>pero lo nuestro es pasar,</line>
<line>pasar haciendo caminos,</line>
<line>caminos sobre el mar.</line>
</stanza>
<stanza> <line>Nunca persequ la gloria,</line>
<line>ni dejar en la memoria</line>
<line>de los hombres mi cancin;</line>
<line> yo amo los mundos sutiles, </line>
<line> ingrvidos y gentiles, </line>
<line> como pompas de jabn. </line>
</stanza>
</poem>


My XSL
======

<xsl:template match="P">
<xsl:analyze-string select="." regex="[^-a-z]+.[a-z]&#10;">
  <xsl:matching-substring>
<line>
    <xsl:value-of select="."/>
</line>
  </xsl:matching-substring>
  <xsl:non-matching-substring>
    <xsl:value-of select="."/>
  </xsl:non-matching-substring>
</xsl:analyze-string>
  </xsl:template>


My output is not properly. I am missing in regex expression. Please any advice how catch every line and enter space.

Thanks and Regards
Byomokesh

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.