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

difficulty using xsl:analyze-string

Subject: difficulty using xsl:analyze-string
From: "Mukul Gandhi gandhi.mukul@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Jul 2018 05:33:53 -0000
 difficulty using xsl:analyze-string
Hi all,
   I'm trying to run a small XSLT 2.0 stylesheet, using Saxon-EE 9.7.0.19
embedded in Oxygen XML Editor. I'm having some difficulty using
the xsl:analyze-string instruction.

My current XSLT 2.0 transform is,

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                         version="2.0">

    <xsl:output method="html"/>

    <xsl:template match="/">
        <html>
          <head>
             <title>test</title>
          </head>
          <body>
              <xsl:analyze-string select="'hello world\nexperimenting with
XSLT\nhow are you'" regex="\n">
                  <xsl:matching-substring>
                      <br/>
                  </xsl:matching-substring>
                  <xsl:non-matching-substring>
                      <xsl:value-of select="."/>
                  </xsl:non-matching-substring>
              </xsl:analyze-string>
          </body>
        </html>
    </xsl:template>

</xsl:stylesheet>

The above XSLT transform doesn't take any other XML input. I'm current
having the above XSLT stylesheet as an input XML (which is a dummy XML
input) to the transform.

As you can see, the xsl:analyze-string's select attribute has a hard-coded
string.

I'm expecting an output like following, from the transform,

<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>test</title>
   </head>
   <body>hello world<br/>experimenting with XSLT<br/>how are you</body>
</html>

(i.e \n replaced with <br/>)

But instead I'm getting following output,

<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>test</title>
   </head>
   <body>hello world\nexperimenting with XSLT\nhow are you</body>
</html>

(the input string is not broken as per the semantics of xsl:analyze-string)

Any help to resolve this would be great.



-- 
Regards,
Mukul Gandhi

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.