I'm a XSLT beginner, but managed to write one successful transformation in the recent past.
This time, however I'm having trouble "lifting off", i.e.: For some odd reason the XML root element isn't matched when I name it.
However it will be matched when I use just /
.
Let's start seeing the outline of the XML document (I didn't write that; "professional companies" create such):
<?xml version="1.0" encoding="utf-8"?>
<PartnerMasterDataSet xmlns="http://tempuri.org/PartnerMasterDataSet.xsd">
<Partner>
<Id>40</Id>
<!-- ... -->
</Partner>
</PartnerMasterDataSet>
The final line has no trailing EOL sequence (in case that matters).
There are multiple elements like Id
(and multiple Partner
s).
What I tried in my XSL:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" />
<xsl:template match="/PartnerMasterDataSet">
<table>
<!-- <xsl:apply-templates select="Partner" /> -->
</table>
</xsl:template>
</xsl:stylesheet>
I'm using xsltproc
from libxslt-tools-1.1.28
to process the input, in case it's important.
When using match="/"
, I get a match (verbose messages) like this:
xsltProcessOneNode: applying template '/' for /
xsltApplySequenceConstructor: copy text root
However when I use match="/PartnerMasterDataSet"
(or match="//PartnerMasterDataSet"
), the I don't get a match, which I don't understand.
Then the messages are:
xsltProcessOneNode: no template found for /
xsltProcessOneNode: no template found for PartnerMasterDataSet