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

Re: Ungready Flag on Regex

Subject: Re: Ungready Flag on Regex
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 22 Oct 2020 21:53:36 -0000
Re:  Ungready Flag on Regex
On 22.10.2020 23:48, Martin Honnen martin.honnen@xxxxxx wrote:

I think the issue is your use of text value templates


<xsl:non-matching-substring>{pt:replaceTextArobase(.)}</xsl:non-matching-subs
tring>

that strips any elements; you need to use B <xsl:non-matching-substring> B B B <xsl:sequence select="pt:replaceTextArobase(.)"/> B </xsl:non-matching-substring>

and so on:


  <xsl:function name="pt:replaceTextMarkers" as="item()+">
    <xsl:param name="s" as="xs:string"/>
    <xsl:analyze-string select="$s" regex="\*\*(.*?)\*\*">
      <xsl:matching-substring><text:span
text:style-name="TB">{pt:replaceTextDollar(substring(.,3,
string-length(.)-4))}</text:span></xsl:matching-substring>
      <xsl:non-matching-substring>
        <xsl:sequence select="pt:replaceTextDollar(.)"/>
      </xsl:non-matching-substring>
    </xsl:analyze-string>
  </xsl:function>

  <xsl:function name="pt:replaceTextDollar" as="item()+">
    <xsl:param name="s" as="xs:string"/>
    <xsl:analyze-string select="$s" regex="\$\$(.*?)\$\$">
      <xsl:matching-substring><text:span
text:style-name="TCode"><xsl:sequence
select="pt:replaceTextArobase(substring(.,3,
string-length(.)-4))"/></text:span></xsl:matching-substring>
      <xsl:non-matching-substring><xsl:sequence
select="pt:replaceTextArobase(.)"/></xsl:non-matching-substring>
    </xsl:analyze-string>
  </xsl:function>

  <xsl:function name="pt:replaceTextArobase" as="item()+">
    <xsl:param name="s" as="xs:string"/>
    <xsl:analyze-string select="$s" regex="@@(.*?)@@">
      <xsl:matching-substring><text:span
text:style-name="TLink"><xsl:sequence select="substring(.,3,
string-length(.)-4)"/></text:span></xsl:matching-substring>
      <xsl:non-matching-substring>{.}</xsl:non-matching-substring>
    </xsl:analyze-string>
  </xsl:function>

  <xsl:function name="pt:unescapeSpecialChars" as="xs:string">
    <xsl:param name="s" as="xs:string"/>
    <xsl:sequence select="$s=>replace('\*', '*', 'q')=>replace('\$',
'$', 'q')=>replace('\@','@', 'q')"/>
  </xsl:function>

All green now in XSpec.

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.