Open Bug 1736512 Opened 4 years ago Updated 3 years ago

XSLTProcessor does not process xsl file with sort tag

Categories

(Core :: XSLT, defect)

Firefox 93
defect

Tracking

()

UNCONFIRMED

People

(Reporter: narendra.chaudhari17, Unassigned)

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36

Steps to reproduce:

xml file:
<fields>
<field name="overriddencreatedon" displayname="Record Created On" datatype="datetime" required="false" orgrequired="none"/>
<field name="accountnumber" displayname="Account Number" datatype="text" required="false" orgrequired="none"/>
<field name="address1_postofficebox" displayname="Address 1: Post Office Box" datatype="text" required="false" orgrequired="none"/>
</fields>

xsl file:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common" version="2.0">
<xsl:output method="html"/>
<xsl:param name="sortColumnName"/>
<xsl:param name="languageName"/>
<xsl:param name="sortOrder"/>
<xsl:param name="RTL"/>
<xsl:variable name="FriendlyTypeNames"> </xsl:variable>
<xsl:template match="/fields">
<table id="Fields" cellpadding="0" cellspacing="0" style="table-layout: fixed;">
<xsl:choose>
<xsl:when test="$sortOrder='ascending'">
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="field">
<xsl:sort order="descending" select="@displayname[$sortColumnName='displayname'] | @name[$sortColumnName='name'] | @datatype[$sortColumnName='datatype']" lang="$languageName"/>
<xsl:call-template name="renderRow"/>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</table>
</xsl:template>
<xsl:template name="renderRow">
<tr >

			<td width="36%"> 
							<xsl:value-of select="@displayname"/> 
			</td> 
		</tr> 
</xsl:template>

</xsl:stylesheet>
html file:
<!DOCTYPE html>
<html>
<head>
<script>
function loadXMLDoc(filename)
{
if (window.ActiveXObject)
{
xhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
else
{
xhttp = new XMLHttpRequest();
}
xhttp.open("GET", filename, false);
try {xhttp.responseType = "msxml-document"} catch(err) {} // Helping IE11
xhttp.send("");
return xhttp.responseXML;
}

function displayResult()
{
xml = loadXMLDoc("cdcatalog.xml");
xsl = loadXMLDoc("cdcatalog_client.xsl");

xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml, document);
document.getElementById("example").appendChild(resultDocument);

}
</script>
</head>
<body onload="displayResult()">
<div id="example" />
</body>
</html>

Actual results:

if we remove the sort node from xsl file it process the transformToFragment else throw error

Expected results:

it should have processed the file, its working in older version as well as in never version 94. The issue only in 93

Attached file XSLTProcessor.html
Attached file cdcatalog_client.xsl
Attached file cdcatalog.xml

Hi narendra.chaudhari17,
from a QA standpoint I believe there is nothing that I can do here.
I've assigned a component in order to get the dev team involved, who might take a closer look at this and offer some additional info/help.

Thank you!

Component: Untriaged → XSLT
Product: Firefox → Core
Severity: -- → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: