How to write BreakPoint Condtions

Questions about XML that are not covered by the other forums should go here.
325526
Posts: 9
Joined: Mon Jan 13, 2020 4:44 pm

How to write BreakPoint Condtions

Post by 325526 » Thu Jan 16, 2020 5:22 pm

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="&#10;">
<!-- 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>

adrian
Posts: 2617
Joined: Tue May 17, 2005 4:01 pm

Re: How to write BreakPoint Condtions

Post by adrian » Tue Jan 21, 2020 5:23 pm

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:

Code: Select all

Identifier/Identifier_Type='ABC'
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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

325526
Posts: 9
Joined: Mon Jan 13, 2020 4:44 pm

Re: How to write BreakPoint Condtions

Post by 325526 » Wed Jan 22, 2020 5:23 pm

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.

adrian
Posts: 2617
Joined: Tue May 17, 2005 4:01 pm

Re: How to write BreakPoint Condtions

Post by adrian » Wed Jan 22, 2020 6:28 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

325526
Posts: 9
Joined: Mon Jan 13, 2020 4:44 pm

Re: How to write BreakPoint Condtions

Post by 325526 » Thu Jan 23, 2020 12:33 pm

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.

adrian
Posts: 2617
Joined: Tue May 17, 2005 4:01 pm

Re: How to write BreakPoint Condtions

Post by adrian » Thu Jan 23, 2020 3:24 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

325526
Posts: 9
Joined: Mon Jan 13, 2020 4:44 pm

Re: How to write BreakPoint Condtions

Post by 325526 » Thu Jan 23, 2020 3:41 pm

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.

adrian
Posts: 2617
Joined: Tue May 17, 2005 4:01 pm

Re: How to write BreakPoint Condtions

Post by adrian » Thu Jan 23, 2020 5:35 pm

Hi,

No. That has a boolean result, so you can't count it. It's:

Code: Select all

count(Identifier[Identifier_Type='ABC']) > 1
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

325526
Posts: 9
Joined: Mon Jan 13, 2020 4:44 pm

Re: How to write BreakPoint Condtions

Post by 325526 » Thu Jan 23, 2020 6:12 pm

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.

adrian
Posts: 2617
Joined: Tue May 17, 2005 4:01 pm

Re: How to write BreakPoint Condtions

Post by adrian » Thu Jan 23, 2020 6:55 pm

Hi,

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
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

325526
Posts: 9
Joined: Mon Jan 13, 2020 4:44 pm

Re: How to write BreakPoint Condtions

Post by 325526 » Fri Jan 24, 2020 4:56 am

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.

adrian
Posts: 2617
Joined: Tue May 17, 2005 4:01 pm

Re: How to write BreakPoint Condtions

Post by adrian » Tue Jan 28, 2020 7:17 pm

325526 wrote:
Fri Jan 24, 2020 4:56 am
Would it be possible to provide me a document/link for how to create XSD so that I can use it as reference.
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

325526
Posts: 9
Joined: Mon Jan 13, 2020 4:44 pm

Re: How to write BreakPoint Condtions

Post by 325526 » Wed Feb 12, 2020 12:41 pm

OxygenXML Video.PNG
OxygenXML Video.PNG (17.86 KiB) Viewed 313 times
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.

adrian
Posts: 2617
Joined: Tue May 17, 2005 4:01 pm

Re: How to write BreakPoint Condtions

Post by adrian » Wed Feb 12, 2020 4:20 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

325526
Posts: 9
Joined: Mon Jan 13, 2020 4:44 pm

Re: How to write BreakPoint Condtions

Post by 325526 » Wed Feb 12, 2020 4:46 pm

Hi Adrian,

Web browser: Firefox
OS: Windows 10

Regards.

adrian
Posts: 2617
Joined: Tue May 17, 2005 4:01 pm

Re: How to write BreakPoint Condtions

Post by adrian » Fri Feb 14, 2020 3:27 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

325526
Posts: 9
Joined: Mon Jan 13, 2020 4:44 pm

Re: How to write BreakPoint Condtions

Post by 325526 » Mon Feb 17, 2020 12:23 pm

Hi Adrian,

Yes, we have proxy which filters some content.

Regards.

Post Reply