Skip to content

xsltProcess fails matching //section XPath expression #117

@pamoller

Description

@pamoller

In the following the Deno program xsltProcess fails matching //section XPath expression as expected. //* behaves as excpected.

import { Xslt, XmlParser } from 'npm:xslt-processor'
const xslt = new Xslt();
const xmlParser = new XmlParser();
let result = await xslt.xsltProcess(
    xmlParser.xmlParse('<root id="n12"><section id="n1">1</section><section id="n2">2</section></root>'),
    xmlParser.xmlParse(`<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text" encoding="UTF-8" />
    <xsl:template match="//section">
        <xsl:value-of select="." />
    </xsl:template>
</xsl:stylesheet>`));
console.log(result);

results in


instead of

12

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions