Inspecting keys while debugging an XSL transform?
Oxygen general issues.
-
- Posts: 51
- Joined: Fri Jan 27, 2006 12:51 am
Inspecting keys while debugging an XSL transform?
I'm trying to debug an XSL transform. I'm getting behavior I'm not expecting because an entry in a key isn't being matched. I can't figure out any way, while debugging, to view the values in the key.
Is there a way to see what the content of the key so I can figure out why it's not being matched?
Is there a way to see what the content of the key so I can figure out why it's not being matched?
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi,
Yes, you can inspect what a key matches during debugging. In the XWatch view enter the key expression and as Value you should get the nodes that key matches, click on them and the Nodes/Values Set view will display them in a tree view.
For instance having an XML document like
and a stylesheet that declares a key matching tag elements
if you enter in the XWatch view as Expression
Then you should be able to see as value Node Set(3) and if you click on that you will see the tree tag nodes in a tree view and if you click in that tree view the corresponding text areas that contain those nodes will be selected.
Best Regards,
George
Yes, you can inspect what a key matches during debugging. In the XWatch view enter the key expression and as Value you should get the nodes that key matches, click on them and the Nodes/Values Set view will display them in a tree view.
For instance having an XML document like
Code: Select all
<test>
<tag name="1">a</tag>
<tag name="1">b</tag>
<tag name="1">c</tag>
<tag name="2">a</tag>
<tag name="3">a</tag>
<tag name="3">b</tag>
<tag name="3">c</tag>
<tag name="4">a</tag>
<tag name="4">b</tag>
<tag name="5">a</tag>
</test>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="test" match="tag" use="@name"/>
<xsl:template match="/">
<aresult>
<xsl:for-each select="*/*">
<xsl:copy/>
</xsl:for-each>
</aresult>
</xsl:template>
</xsl:stylesheet>
Code: Select all
key('test','1')
Best Regards,
George
-
- Posts: 64
- Joined: Tue May 17, 2005 9:16 am
View Key sets in variables pane
Post by jokester01au »
Hi,
Its good that we can use XWatch to get a particular key value, but it would be even better if declared keys would appear in the variables pane.
Regards,
Joe.
Its good that we can use XWatch to get a particular key value, but it would be even better if declared keys would appear in the variables pane.
Regards,
Joe.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
-
- Posts: 64
- Joined: Tue May 17, 2005 9:16 am
View keys in XSLT debugger
Post by jokester01au »
Hi,
In fact, now that I come to try putting a key function into XWatch, it is telling me "The key() function is available only in XPath expressions within an XSLT stylesheet", so it seems that it is no longer possible to use XWatch for probing keys.
I have tried this both in Eclipse and in the standalone version 8.0.
Is there any kind of workaround?
Regards,
Joe.
In fact, now that I come to try putting a key function into XWatch, it is telling me "The key() function is available only in XPath expressions within an XSLT stylesheet", so it seems that it is no longer possible to use XWatch for probing keys.
I have tried this both in Eclipse and in the standalone version 8.0.
Is there any kind of workaround?
Regards,
Joe.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
I get the error "The key() function is available only in XPath expressions within an XSLT stylesheet" in the XWatch view only with Saxon 8B. With Saxon 6 or Xalan the key function can be used: I enter the expression
or
in the Expression column of the XWatch view and I get a Node Set(3) or a Node Set(2) value in the Value column. We will try to see if Saxon 8 cannot evaluate the function or oXygen does not evaluate the expression correctly. Thank you for letting us know.
Regards,
Sorin
Code: Select all
key('test', '1')
Code: Select all
key('test', '4')
Regards,
Sorin
-
- Posts: 15
- Joined: Wed Jan 29, 2014 8:29 am
Re: Inspecting keys while debugging an XSL transform?
Post by juicejuice »
Sorry for digging up a 10 year old thread, but this is what Google coughed up
This issue still exists in oXygen 18.0, "The key() function is available only in XPath expression within an XSLT stylesheet".

-
- Posts: 143
- Joined: Tue Mar 25, 2003 11:21 am
Re: Inspecting keys while debugging an XSL transform?
Hello,
The Saxon 9.x does not allow us to query the key function oustide the XSLT stylesheet.
As a workaround you can add an xsl:variable that evaluates the key and watch that in the dedicated panel.
Regards,
Mircea.
The Saxon 9.x does not allow us to query the key function oustide the XSLT stylesheet.
As a workaround you can add an xsl:variable that evaluates the key and watch that in the dedicated panel.
Regards,
Mircea.
Mircea Enachescu
<oXygen> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service