How to write BreakPoint Condtions
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 10
- Joined: Mon Jan 13, 2020 4:44 pm
How to write BreakPoint Condtions
I have XML and XSLT code with below structure. I want to know how to write Breakpoint condition to spit out the record which has multiple national ID (identifier_Type = 'ABC')?
XML Code:
<pi:PayGroup>
<pi:Header>
<pi:Version/>
<pi:Payroll_Company_ID> </pi:Payroll_Company_ID>
<pi:Payroll_Company_Name> </pi:Payroll_Company_Name>
<pi:Pay_Group_ID/>
<pi:Pay_Group_Name/>
</pi:Header>
<pi:Employee>
<pi:Summary>
<pi:Employee_ID/>
<pi:Name> dolor</pi:Name>
<pi:Payroll_Company_ID> </pi:Payroll_Company_ID>
<pi:Payroll_Company_Name> </pi:Payroll_Company_Name>
<pi:Pay_Group_ID/>
<pi:Pay_Group_Name> </pi:Pay_Group_Name>
</pi:Summary>
<pi:Personal>
<pi:First_Name pi:PriorValue=""/>
</pi:Personal>
<pi:Status>
<pi:Payroll_Company pi:PriorValue=""> </pi:Payroll_Company>
<pi:Pay_Group pi:PriorValue=""> </pi:Pay_Group>
</pi:Status>
<pi:Identifier>
<pi:Operation/>
<pi:Identifier_Type pi:PriorValue="">ABC</pi:Identifier_Type>
<pi:Identifier_Value pi:PriorValue="">123-456-7891</pi:Identifier_Value>
</pi:Identifier>
<pi:Identifier>
<pi:Operation/>
<pi:Identifier_Type pi:PriorValue="">ABC</pi:Identifier_Type>
<pi:Identifier_Value pi:PriorValue="">123-456-7891</pi:Identifier_Value>
</pi:Identifier>
</pi:Employee>
</pi:PayGroup>
XSLT Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs" xmlns:xtt="urn:com.workday/xtt"
xmlns:this="urn:this-stylesheet" version="2.0">
<xsl:template match="Payroll_Extract_Employees">
<File xtt:quotes="always" xtt:quoteStyle="double">
<xsl:call-template name="fieldHeaders"/>
<xsl:apply-templates/>
</File>
</xsl:template>
<xsl:template name="fieldHeaders">
<FieldHeaders xtt:separator="," xtt:endTag=" ">
<!-- Header Details -->
</FieldHeaders>
</xsl:template>
<!--Do nothing for the PayGroup Headers -->
<xsl:template match="PayGroup/Header"/>
<!-- Detail Records -->
<xsl:template match="PayGroup/Employee">
<!-- Extract Record details-->
</xsl:template>
</xsl:stylesheet>
XML Code:
<pi:PayGroup>
<pi:Header>
<pi:Version/>
<pi:Payroll_Company_ID> </pi:Payroll_Company_ID>
<pi:Payroll_Company_Name> </pi:Payroll_Company_Name>
<pi:Pay_Group_ID/>
<pi:Pay_Group_Name/>
</pi:Header>
<pi:Employee>
<pi:Summary>
<pi:Employee_ID/>
<pi:Name> dolor</pi:Name>
<pi:Payroll_Company_ID> </pi:Payroll_Company_ID>
<pi:Payroll_Company_Name> </pi:Payroll_Company_Name>
<pi:Pay_Group_ID/>
<pi:Pay_Group_Name> </pi:Pay_Group_Name>
</pi:Summary>
<pi:Personal>
<pi:First_Name pi:PriorValue=""/>
</pi:Personal>
<pi:Status>
<pi:Payroll_Company pi:PriorValue=""> </pi:Payroll_Company>
<pi:Pay_Group pi:PriorValue=""> </pi:Pay_Group>
</pi:Status>
<pi:Identifier>
<pi:Operation/>
<pi:Identifier_Type pi:PriorValue="">ABC</pi:Identifier_Type>
<pi:Identifier_Value pi:PriorValue="">123-456-7891</pi:Identifier_Value>
</pi:Identifier>
<pi:Identifier>
<pi:Operation/>
<pi:Identifier_Type pi:PriorValue="">ABC</pi:Identifier_Type>
<pi:Identifier_Value pi:PriorValue="">123-456-7891</pi:Identifier_Value>
</pi:Identifier>
</pi:Employee>
</pi:PayGroup>
XSLT Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs" xmlns:xtt="urn:com.workday/xtt"
xmlns:this="urn:this-stylesheet" version="2.0">
<xsl:template match="Payroll_Extract_Employees">
<File xtt:quotes="always" xtt:quoteStyle="double">
<xsl:call-template name="fieldHeaders"/>
<xsl:apply-templates/>
</File>
</xsl:template>
<xsl:template name="fieldHeaders">
<FieldHeaders xtt:separator="," xtt:endTag=" ">
<!-- Header Details -->
</FieldHeaders>
</xsl:template>
<!--Do nothing for the PayGroup Headers -->
<xsl:template match="PayGroup/Header"/>
<!-- Detail Records -->
<xsl:template match="PayGroup/Employee">
<!-- Extract Record details-->
</xsl:template>
</xsl:stylesheet>
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: How to write BreakPoint Condtions
Hello,
A breakpoint on the XML source only works if the context (current node) of a template contains or is the node involved in the breakpoint.
In your example xsl:template/@match="PayGroup/Employee" contains the node you're looking for, so in that context the breakpoint condition for what you want is:
Note that since the context is actually the PayGroup/Employee, it will highlight the employee in the XML source, if for that employee Identifier/Identifier_Type is'ABC'.
If you want better granularity, you need a more specific xsl:template/@match. e.g. One that actually indicates the Identifier.
Regards,
Adrian
A breakpoint on the XML source only works if the context (current node) of a template contains or is the node involved in the breakpoint.
In your example xsl:template/@match="PayGroup/Employee" contains the node you're looking for, so in that context the breakpoint condition for what you want is:
Code: Select all
Identifier/Identifier_Type='ABC'
If you want better granularity, you need a more specific xsl:template/@match. e.g. One that actually indicates the Identifier.
Regards,
Adrian
Adrian Buza
<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
-
- Posts: 10
- Joined: Mon Jan 13, 2020 4:44 pm
Re: How to write BreakPoint Condtions
Hi,
Thank you Adrian. The break point condition worked.
I am facing another issue:
When breakpoints are placed and execution stops at a break point, some variables must be there in the Variables view, correct? But i don't see any variables in the Variables view.
Thank you Adrian. The break point condition worked.
I am facing another issue:
When breakpoints are placed and execution stops at a break point, some variables must be there in the Variables view, correct? But i don't see any variables in the Variables view.
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: How to write BreakPoint Condtions
Hi,
Variable evaluation depends a lot on the debugger and XSLT engine.
What version of Oxygen are you using?
Which XSLT engine (including version) are you using to debug (Saxon-HE/PE/EE)?
BTW, try to disable optimizations or set optimization level to 0 (older versions) in the "Advanced options" (cogwheel icon next to the XSLT engine combo) from the XSLT debugger toolbar. Otherwise, some of the variables (especially those that used only once) are evaluated inline when optimized, so they are never assigned a value.
Regards,
Adrian
Variable evaluation depends a lot on the debugger and XSLT engine.
What version of Oxygen are you using?
Which XSLT engine (including version) are you using to debug (Saxon-HE/PE/EE)?
BTW, try to disable optimizations or set optimization level to 0 (older versions) in the "Advanced options" (cogwheel icon next to the XSLT engine combo) from the XSLT debugger toolbar. Otherwise, some of the variables (especially those that used only once) are evaluated inline when optimized, so they are never assigned a value.
Regards,
Adrian
Adrian Buza
<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
-
- Posts: 10
- Joined: Mon Jan 13, 2020 4:44 pm
Re: How to write BreakPoint Condtions
Hi Adrian,
The Version of Oxygen i am using is XML Editor 19.0.
I am using Saxon-HE 9.7.0.15 to debug.
I tried setting the optimization level to 0 but still not able to see anything in Variable view.
Regards.
The Version of Oxygen i am using is XML Editor 19.0.
I am using Saxon-HE 9.7.0.15 to debug.
I tried setting the optimization level to 0 but still not able to see anything in Variable view.
Regards.
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: How to write BreakPoint Condtions
Hi,
There were some issues in v19 with variable evaluation, but the symptoms were the variable was listed, but had no value, instead there was a message "The variable value is undefined". This was later fixed in v21.
I don't have v19.0 readily available to test, it is no longer being supported. Could you please try with at least v19.1 (also soon to be retired)?
Is the variable used in the context where the debugger is stopped? Would it be possible to provide a code snippet or the actual XSLT being debugged?
If you want to keep it private, please send it to support@oxygenxml.com
Regards,
Adrian
There were some issues in v19 with variable evaluation, but the symptoms were the variable was listed, but had no value, instead there was a message "The variable value is undefined". This was later fixed in v21.
I don't have v19.0 readily available to test, it is no longer being supported. Could you please try with at least v19.1 (also soon to be retired)?
Is the variable used in the context where the debugger is stopped? Would it be possible to provide a code snippet or the actual XSLT being debugged?
If you want to keep it private, please send it to support@oxygenxml.com
Regards,
Adrian
Adrian Buza
<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
-
- Posts: 10
- Joined: Mon Jan 13, 2020 4:44 pm
Re: How to write BreakPoint Condtions
Hi Adrian,
I will update it to v19.1.
I am able to get the variables now in the variable view as break point was placed on a variable.
Thank you for the help.
If i want to spit the record which has more than one identifier/identifier_type = "ABC" then the break point condition would be
count (identifier/identifier_type = "ABC") > 1, correct?
Regards.
I will update it to v19.1.
I am able to get the variables now in the variable view as break point was placed on a variable.
Thank you for the help.
If i want to spit the record which has more than one identifier/identifier_type = "ABC" then the break point condition would be
count (identifier/identifier_type = "ABC") > 1, correct?
Regards.
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: How to write BreakPoint Condtions
Hi,
No. That has a boolean result, so you can't count it. It's:
Regards,
Adrian
No. That has a boolean result, so you can't count it. It's:
Code: Select all
count(Identifier[Identifier_Type='ABC']) > 1
Adrian
Adrian Buza
<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
-
- Posts: 10
- Joined: Mon Jan 13, 2020 4:44 pm
Re: How to write BreakPoint Condtions
Hi Adrian,
The break point condition count(Identifier[Identifier_Type='ABC']) > 1 isn't working for me.
Its working only if i provide count(Identifier/Identifier_Type) > 1. For a particular type isn't working. Please advise.
Regards.
The break point condition count(Identifier[Identifier_Type='ABC']) > 1 isn't working for me.
Its working only if i provide count(Identifier/Identifier_Type) > 1. For a particular type isn't working. Please advise.
Regards.
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: How to write BreakPoint Condtions
Hi,
It works for me on the example you have provided above. Testing on v21.1.
Try:
Regards,
Adrian
It works for me on the example you have provided above. Testing on v21.1.
Try:
Code: Select all
count(Identifier/Identifier_Type[.='ABC']) > 1
Adrian
Adrian Buza
<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
-
- Posts: 10
- Joined: Mon Jan 13, 2020 4:44 pm
Re: How to write BreakPoint Condtions
Hi Adrian,
The below condition worked.
Thank you very much for the help!!!
Would it be possible to provide me a document/link for how to create XSD so that I can use it as reference.
Regards.
The below condition worked.
Thank you very much for the help!!!
Would it be possible to provide me a document/link for how to create XSD so that I can use it as reference.
Regards.
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: How to write BreakPoint Condtions
You want to create an XSD from scratch or generate an XSD from existing XML files?
There are some video presentations on our web site: https://www.oxygenxml.com/videos.html (use the Schemas filter)
e.g.
Developing XML Schemas
Regards,
Adrian
Adrian Buza
<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
-
- Posts: 10
- Joined: Mon Jan 13, 2020 4:44 pm
Re: How to write BreakPoint Condtions
OxygenXML Video.PNG
Hi Adrian,Yes, I want to create XSD from scratch.
I tried to open the link you provided but i an unable to open it. Its blank. Please advise.
Regards.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: How to write BreakPoint Condtions
Hi,
I checked and the page works just fine in Firefox and Chrome for me.
What web browser are you using and on what OS?
Alternatively go directly to YouTube, to our channel:
https://www.youtube.com/user/oxygenxml/videos
Regards,
Adrian
I checked and the page works just fine in Firefox and Chrome for me.
What web browser are you using and on what OS?
Alternatively go directly to YouTube, to our channel:
https://www.youtube.com/user/oxygenxml/videos
Regards,
Adrian
Adrian Buza
<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
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: How to write BreakPoint Condtions
There is an embedded YouTube player on that page. It works fine for me with Firefox 73.0 on Windows 10.
Are you perhaps behind a corporate proxy/firewall that may be filtering some content (e.g. YouTube)?
Regards,
Adrian
Are you perhaps behind a corporate proxy/firewall that may be filtering some content (e.g. YouTube)?
Regards,
Adrian
Adrian Buza
<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
Return to “General XML Questions”
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