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

Re: Empty input in analyze-string

Subject: Re: Empty input in analyze-string
From: "Mathieu Malaterre" <mathieu.malaterre@xxxxxxxxx>
Date: Fri, 4 Jul 2008 15:35:32 +0200
Re:  Empty input in analyze-string
On Fri, Jul 4, 2008 at 3:30 PM, Joe Fawcett <joefawcett@xxxxxxxxxxx> wrote:
> Seems to me that the empty string doesn't match or mismatch:
>
> <data>
>  <para>C.1</para>
>  <para>F.1</para>
>  <para></para>
>  <para>H.1</para>
>  <para>F.2</para>
> </data>
>
> <xsl:stylesheet version="2.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
>  <xsl:template match="/">
>   <xsl:variable name="myregex">^([CF]\.[0-9\.]+)\s*(.*)$</xsl:variable>
>   <output>
>     <xsl:for-each select="data/para">
>       <input><xsl:value-of select="."/></input>
>       <xsl:analyze-string select="." regex="{$myregex}">
>         <xsl:matching-substring>
>           <match>
>             <xsl:value-of select="."/>
>           </match>
>         </xsl:matching-substring>
>         <xsl:non-matching-substring>
>           <nonmatch>
>             <xsl:value-of select="."/>
>           </nonmatch>
>         </xsl:non-matching-substring>
>       </xsl:analyze-string>
>     </xsl:for-each>
>   </output>
>  </xsl:template>
> </xsl:stylesheet>
>
> I get (with Saxon 9.1):
> <output>
>  <input>C.1</input>
>  <match>C.1</match>
>  <input>F.1</input>
>  <match>F.1</match>
>  <input/>
>  <input>H.1</input>
>  <nonmatch>H.1</nonmatch>
>  <input>F.2</input>
>  <match>F.2</match>
> </output>

How, ok I did not realized that, it was simply going through.

So how do I make it a non-match ?

thanks,
-- 
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.