1

I'm new to XSLT, but I have looked into this and I can't seem to get this working. I've got an xsl document and an external xml document. I'm importing the document as a variable $LOOKUP

External XML

<?xml version="1.0" encoding="UTF-8"?>
<labels>
    <label ead="physloc">Physical Location</label>
    <label ead="unittitle">Title</label>
</labels>

VARIABLE

<xsl:variable name="LOOKUP" select="document('includes/labels.xml', /)" />

XSL

<xsl:value-of select="$LOOKUP/labels/label[@ead='unittitle']" />

When I'm debugging this (oXygen with Saxon EE 9.5.1.7) I can see that the document has been imported, and I can even browse the Node/Value set with the debugger, but I get nothing printed out.

What am I doing wrong?

  • Perhaps your stylesheet uses `xpath-default-namespace` and that way the path does not work. Try ``. If that does not help then show us minimal but complete samples allowing us to reproduce the problem. – Martin Honnen Nov 21 '14 at 17:00
  • @MartinHonnen That was the answer. Thank you very much. I've been pulling my hair out on that one. – JeremyGibson Nov 21 '14 at 17:19
  • OK, I have put my suggestion into an answer so that you can accept it and the question is marked as solved. – Martin Honnen Nov 21 '14 at 17:21

1 Answers1

1

Perhaps your stylesheet uses xpath-default-namespace and that way the path does not work. Try <xsl:value-of xpath-default-namespace="" select="$LOOKUP/labels/label[@ead='unittitle']" />.

Martin Honnen
  • 160,499
  • 6
  • 90
  • 110