XSLT Transformation failed

Bug #1977635 reported by Sandeep Singh
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Invalid
Undecided
Unassigned

Bug Description

Hi Team,

I have an xslt code in 2.0 version and this is validated and well form and not any issue in oxygen editor or saxon parser for transformation or any kind of operation but i have use this xslt in through lxml and try to transform our file through xslt function i have get e below error:

Traceback (most recent call last):
  File "C:/XSpec_Create/test/3-may-2022/a - orig.py", line 13, in <module>
    xslt_transformer = ET.XSLT(xslt_doc)
  File "src\lxml\xslt.pxi", line 412, in lxml.etree.XSLT.__init__
lxml.etree.XSLTParseError: xsl:value-of : could not compile select expression 'format-number(index-of(('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'), lower-case(substring(regex-group(2), 1, 3))), '00')'

Also see below xslt code for reference:
<xsl:analyze-string select="." regex="(\d+)\s([A-Za-z]+)\s(\d{{4}})\.">
                     <xsl:matching-substring>

                        <!--<xsl:variable name="MONTH">
                           <xsl:value-of
                              select="format-number(index-of(('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'), lower-case(substring(regex-group(2), 1, 3))), '00')"
                           />
                        </xsl:variable>-->
                        <xsl:variable name="DAY">
                           <xsl:value-of select="format-number(number(regex-group(1)), '00')"/>
                        </xsl:variable>
                        <xsl:element name="date">
                           <xsl:if test="not($MONTH = 'NaN')">
                              <xsl:if test="$DAY &gt; 0 and $DAY &lt; 32">
                                 <xsl:attribute name="day">
                                    <xsl:value-of select="$DAY"/>
                                 </xsl:attribute>
                              </xsl:if>
                              <xsl:attribute name="month">
                                 <xsl:value-of select="$MONTH"/>
                              </xsl:attribute>
                           </xsl:if>
                           <xsl:attribute name="year" select="regex-group(3)"/>
                           <xsl:value-of
                              select="concat(regex-group(1), ' ', regex-group(2), ' ', regex-group(3), '.')"
                           />
                        </xsl:element>
                     </xsl:matching-substring>
                     <xsl:non-matching-substring>
                        <xsl:value-of select="."/>
                     </xsl:non-matching-substring>
                  </xsl:analyze-string>

Kindly please resolve this issue or provide module for transformation if you have.

Thanks
Sandeep Singh

Revision history for this message
scoder (scoder) wrote :

XSLT is implemented in libxslt, not in lxml.

Changed in lxml:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.