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

Re: xsl:analyze-string and line break

Subject: Re: xsl:analyze-string and line break
From: "Mathieu Malaterre" <mathieu.malaterre@xxxxxxxxx>
Date: Wed, 10 Oct 2007 15:55:26 +0200
Re:  xsl:analyze-string and line break
Maybe because text files can be UNIX escaped (\n), dos (\r\n) or mac
(can't remember).

Anyway regex are awsome !

2 cents,
-Mathieu

On 10/10/07, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> I've no idea of the history that caused "." to have this meaning, but your
> observation is correct. To make "." match a newline, use flags="s" on the
> xsl:analyze-string instruction.
>
> Michael Kay
> http://www.saxonica.com/
>
> > -----Original Message-----
> > From: Mathieu Malaterre [mailto:mathieu.malaterre@xxxxxxxxx]
> > Sent: 10 October 2007 11:29
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject:  xsl:analyze-string and line break
> >
> > Hello,
> >
> >   I am trying to do a regex on an expression with line
> > breaks, for some reason '.' does not include line break. I
> > also tried [.\n]* to say anything including line break, with no luck.
> >
> > xml file is:
> >
> > <?xml version="1.0"?>
> > <description>Sex of the named patient. Enumerated Values:
> >  M = male
> >  F = female
> >  O = other</description>
> >
> >
> > and xsl file is:
> > <?xml version="1.0"?>
> > <xsl:transform
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
> >   <xsl:output method="xml" indent="yes"/>
> >   <xsl:template name="parse-enum">
> >     <xsl:param name="text"/>
> >     <xsl:analyze-string select="$text" regex="\n">
> >       <xsl:matching-substring>
> > <!--br/-->
> >       </xsl:matching-substring>
> >       <xsl:non-matching-substring>
> >         <enum>
> >           <xsl:value-of select="."/>
> >         </enum>
> >       </xsl:non-matching-substring>
> >     </xsl:analyze-string>
> >   </xsl:template>
> >   <xsl:template match="/description">
> >     <xsl:analyze-string select="." regex=".*Enumerated
> > Values:([.\n]*)">
> >       <xsl:matching-substring>
> >         <xsl:value-of select="regex-group(1)"/>
> >       </xsl:matching-substring>
> >     </xsl:analyze-string>
> >   </xsl:template>
> > </xsl:transform>
> >
> > Thanks,
> >
> >
> >
> > --
> > Mathieu
>
>


-- 
Mathieu

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-2013 All Rights Reserved.