cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Víctor Pergolesi <victorpergol...@codimat.com.ar>
Subject Re: Regexp matcher with digits
Date Mon, 01 Jun 2009 19:30:32 GMT
I proved some cases that could help you. I hope you undestand me.

1 - All the content of the pattern is read as an unique regular expresion. So the only part
to reference I know is {0}.

2 - BUT there are different situacion if you use:
case A: pattern="\.*(\d*$)"   - Here {0} are all the numbers of the final
case B: pattern="month(\d*$)" - Here {0} is month +  the numbers of the final.

I do not know exactly what you want to capture, but I undestand that could help you.

3 - You could capture the case B and then for example via an xsl retrieve the part you need.

Below are the examples:


<map:match type="regexp" pattern="month(\d*$)">
   <map:generate src="documento.xml"/>
      <map:transform src="documento.xsl">
   <map:parameter name="valor" value="{0}"/>
   </map:transform>
   <map:serialize />
</map:match>
            
            
<map:match type="regexp" pattern="\.*(\d*$)">
   <map:generate src="documento.xml"/>
   <map:transform src="documento.xsl">
      <map:parameter name="valor" value="{0}"/>
   </map:transform>
   <map:serialize />
</map:match>


File documento.xml
<?xml version="1.0" encoding="UTF-8"?>
<elemento></elemento>

File documento.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:param name="valor"/>
    
    <xsl:template match="/">
        <html>
        <head>
            <title>Expresión regular</title>
        </head>
        <body>
            Captura de expresión regular:<br></br>
            - aplication of a function to the value:&#160;<xsl:value-of select="substring-after($valor,'month')"/><br></br>
            - the value {0}:&#160; <xsl:value-of select="$valor"/>
        </body>
        </html>
    </xsl:template>    
            
</xsl:stylesheet>

I hope this help

I will prove if {1} have a value in some case.


Victor Pergolesi
Codimat S.A.
Área Sistemas
Web: www.codimat.com.ar
Tel.: (0291) 459-2480 | 459-2424
Fax: (0291) 459-2400 | 0-800-666-42266
Don Bosco 1495 - B8003CAA Bahía Blanca - Argentina
  _____  

From: Mansour Al Akeel [mailto:mansour.alakeel@gmail.com]
To: users@cocoon.apache.org
Sent: Mon, 01 Jun 2009 15:45:26 -0300
Subject: Re: Regexp matcher with digits

Can someone kindly answer this question and give an example about how to
  use regex and retrieve the matches. I am stuck with a project that's
  writen in Cocoon and I need this to continue.
  
  
  On Sun May 31,2009 01:54 am, Mansour Al Akeel wrote:
  > Ok, let's clarify this and put it in different words. I am able to match
  > on the digits part but not able to obtain this digits
  > 
  > <map:match  type="regexp" pattern="\.*/\d$"> 
  >     ......
  >     .....
  >     <map:parameter name="href" value="{1}"/>
  >     <map:parameter name="depth" value="{2}"/>
  > 
  > The variable {1} is matching and I can obtain as expected, but {2} is
  > not.
  > 
  > 
  > Can someone please share the knowledge and direct me to resolve this ? 
  > 
  > 
  > 
  
  ---------------------------------------------------------------------
  To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
  For additional commands, e-mail: users-help@cocoon.apache.org
  
        


Este mensaje y sus adjuntos contienen información confidencial y son para uso exclusivo del
destinatario. Si hubiese recibido este mensaje por error, o contuviera información que Ud.
no desea recibir, por favor le agradecemos nos lo haga saber y lo elimine de su sistema. Cualquier
inconveniente, enviarlo a librodequejas@codimat.com.ar.
Este correo ha sido chequeado por el servidor de Codimat S.A. www.codimat.com.ar

Mime
View raw message