xsl-list
[Top] [All Lists]

length limitations on string input to xsl:analyze-string

2006-02-24 13:19:09

I am having difficulty using xsl:analyze-string with some lengthy input
(800+ chars).  Is this a known limitation of analyze-string?  I saw
recently that the regular expression itself is limited to about 30
characters, and I may be pushing the limits with this regular expression,
but it does handle inputs of under 800 chars ok.  If I simplify the regular
expression (which I can't really do without losing semantics required for
analysis),  I notice the allowable string length does increase, but it is
still not handling the inputs I need to deal with.

The error message, occurring on the for-each in the following code,  is:
"SXLM0001: Too many nested apply-templates calls. The stylesheet is
probably looping.
Transformation failed: Run-time errors were reported"
implying recursion, which isn't really the case.  My test input only has
one <type>.

The xsl:

<xsl:template match="/">
  <output>
      <xsl:for-each select="container/*">
        <xsl:apply-templates select="." mode="parse_express"/>
      </xsl:for-each>
  </output>
</xsl:template>

<xsl:template match="type" mode="parse">
  <xsl:param name="string" as="xs:string" select="normalize-space(.)" />
  <type>
      <xsl:variable name="regular_expression" select="'([a-z][a-z0-9_]*)'"
/>

   <xsl:analyze-string select="$string" flags="i"
      regex="^{$regular_expression}\s?=\s?([^;]+)\s?;\s?(.*)$">
     <xsl:matching-substring>
      <xsl:message> ANALYZED STRING SUCCESSFULLY </xsl:message>
      <!-- Deal with regex-groups  -->
      </xsl:matching-substring>
      <xsl:non-matching-substring>
        <xsl:message>
          Error: IN NON-MATCHING SUBSTRING
        </xsl:message>
      </xsl:non-matching-substring>
    </xsl:analyze-string>
  </type>
</xsl:template>

My input is in the following format:
<container>
 <type>
      managed_design_object
      =
      SELECT
      (
      adjacent_stratum_surface_definition
      ,
      adjacent_stratum_surface_embedded_component_surface_definition
      ,
      alias_identification
      ,
      alternate_select_product
      ,
    <!--  ......   limit seems to be about 814 characters.  The input I
need to handle is much greater -->
      )
      ;
      </type>
</container>

Any suggestions, short of tokenizing the string the old fashioned way?
Thanks.









***************************************************************************
Heidi Preston
Electric Boat Corporation
75 Eastern Point Road
Groton, CT 06340
(860) 433-8649


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>