XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Charles GoldsteinSubject: XSLT and XPath Questions (New User)
Author: Charles Goldstein
Date: 22 Jan 2019 02:31 PM
Hi,
New user to Stylus Studio and new to XSLT and XPath.
I mainly need to test the XPath queries that I want to put in XSLTs. Can I test all that with Stylus Studio?

Here's my XSLT (partial):
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://jackhenry.com/jxchange/TPG/2008" xmlns:s="http://www.w3.org/2003/05/soap-envelope">

<xsl:template match="/">

<WorkflowTranslatedResponse>
<VariableMap>

<ActivityMapVariable>

<ActivityMapVariable>
<VariableName>LoanAccountArray</VariableName>
<Value>
<xsl:for-each select="s:Envelope/s:Body/a:AcctSrchResponse/a:AcctSrchRecArray/a:AcctSrchRec[a:AcctStat='1']">
<xsl:for-each select="s:Envelope/s:Body/a:AcctSrchResponse/a:AcctSrchRecArray/a:AcctSrchRec[a:AccountId/a:AcctType='L' or a:AccountId/a:AcctType='O']">
<xsl:for-each select="s:Envelope/s:Body/a:AcctSrchResponse/a:AcctSrchRecArray/a:AcctSrchRec[a:ProdCode='EN' or a:ProdCode='HE' or a:ProdCode='20' or a:ProdCode='52' or a:ProdCode='53' or a:ProdCode='54' or a:ProdCode='60' or a:ProdCode='25'or a:ProdCode='9M' or a:ProdCode='9K']">
<xsl:value-of select="a:ProdCode"/><xsl:text>&#32;</xsl:text>
<xsl:value-of select="a:ProdDesc"/><xsl:text>&#32;</xsl:text>
<xsl:value-of select="a:AccountId/a:AcctType"/><xsl:text>&#32;</xsl:text>
<xsl:value-of select="a:AccountId/a:AcctId"/><xsl:text>:Ī~</xsl:text>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</Value>
<DefaultValue>No Loan Accounts Found</DefaultValue>
</ActivityMapVariable>

<ActivityMapVariable>
<VariableName>SentRec</VariableName>
<Value>
<xsl:for-each select="s:Envelope/s:Body/a:AcctSrchResponse/a:SrchMsgRsHdr">
<xsl:value-of select="a:SentRec"/><xsl:text></xsl:text>
</xsl:for-each>
</Value>
<DefaultValue>0</DefaultValue>
</ActivityMapVariable>

<ActivityMapVariable>
<VariableName>WarningDetails</VariableName>
<Value>
<xsl:for-each select="s:Envelope/s:Body/*/a:MsgRsHdr/a:MsgRecInfoArray/a:MsgRec">Response Received:
Code: <xsl:value-of select="a:ErrCode"/>
Cat: <xsl:value-of select="a:ErrCat"/>
Desc: <xsl:value-of select="a:ErrDesc"/>
Elem: <xsl:value-of select="a:ErrElem"/>
ElemVal: <xsl:value-of select="a:ErrElemVal"/>
Loc: <xsl:value-of select="a:ErrLoc"/>
<xsl:if test="position()!=last()"><xsl:text>&#10;&#10;</xsl:text></xsl:if>
</xsl:for-each>
</Value>
</ActivityMapVariable>

<xsl:if test="not(/s:Envelope/s:Body/s:Fault/s:Detail/a:HdrFault/a:FaultRecInfoArray)">
<ActivityMapVariable>
<VariableName>FaultDetails</VariableName>
<Value>
<xsl:text></xsl:text>
</Value>
</ActivityMapVariable>
</xsl:if>
</VariableMap>

</WorkflowTranslatedResponse>
</xsl:template>
</xsl:stylesheet>


I can enter the following in the XPath Query editor:
/s:Envelope/s:Body/a:AcctSrchResponse/a:AcctSrchRecArray/a:AcctSrchRec[a:AcctStat='1'][a:AccountId/a:AcctType='L' or a:AccountId/a:AcctType='O'][a:ProdCode='EN' or a:ProdCode='HE' or a:ProdCode='20' or a:ProdCode='52' or a:ProdCode='53' or a:ProdCode='54' or a:ProdCode='60' or a:ProdCode='25'or a:ProdCode='9M' or a:ProdCode='9K']

and it produces the results I'm expecting.

But how can I test the entire XSLT? I'd like to see the entire output. I'm only transforming to text files, not HTML, so viewing in an output window in Stylus Studio is fine.

Postnext
Ivan PedruzziSubject: XSLT and XPath Questions (New User)
Author: Ivan Pedruzzi
Date: 22 Jan 2019 03:52 PM

Use the XSLT Editor
http://www.stylusstudio.com/xslt-editor.html


Ivan Pedruzzi
Stylus Studio Team

Postnext
Charles GoldsteinSubject: XSLT and XPath Questions (New User)
Author: Charles Goldstein
Date: 22 Jan 2019 04:03 PM
>
>Use the XSLT Editor
>http://www.stylusstudio.com/xslt-editor.html
>
>
So the XSLT Editor doesn't come with Stylus Studio X16 XML Professional Suite 64-bit? It's a separate product?

Postnext
Ivan PedruzziSubject: XSLT and XPath Questions (New User)
Author: Ivan Pedruzzi
Date: 22 Jan 2019 04:25 PM
The XSLT Editor is one of the Stylus Studio editors
It is available in Professional Edition

To create a new XSLT
File -> New -> XSLT Stylesheet

To open an existing XSLT do File -> Open and navigate to your .xsl file


Postnext
Charles GoldsteinSubject: XSLT and XPath Questions (New User)
Author: Charles Goldstein
Date: 22 Jan 2019 05:08 PM
Ok, I was able to open my XSL file but when I execute it, it's not processing against my source XML file, which was selected on the Scenario Properties screen. If you look at my xsl file in my first post, I was expecting some output like this:
60 Mortgage Loan L 123456
HE HELOC Loan O 888777666
20 Special Loan L 334455

Instead, I just see the VariableName of LoanAccountArray and the DefaultValue of No Loan Accounts Found. No Values.

Postnext
Lucia DelmotteSubject: XSLT and XPath Questions (New User)
Author: Lucia Delmotte
Date: 01 Apr 2019 04:21 PM
>Ok, I was able to open my XSL
>file but when I execute it,
>it's not processing against my
>source XML file, which was
>selected on the Scenario
>Properties screen [url=http://www.comparateur-mutuelle-assurance-sante.com/assurance-deces-invalidite]assurances deces[/url]. If you look
>at my xsl file in my first
>post, I was expecting some
>output like this:
>60 Mortgage Loan L 123456
>HE HELOC Loan O 888777666
>20 Special Loan L 334455
>
>Instead, I just see the
>VariableName of
>LoanAccountArray and the
>DefaultValue of No Loan
>Accounts Found. No Values.
In any case, it's good to share between developers because sometimes we crash on some codes.

Postnext
Ivan PedruzziSubject: XSLT and XPath Questions (New User)
Author: Ivan Pedruzzi
Date: 22 Jan 2019 05:27 PM


If you post your input XML we can give it a try

Postnext
Charles GoldsteinSubject: XSLT and XPath Questions (New User)
Author: Charles Goldstein
Date: 22 Jan 2019 06:14 PM
Source XML file attached.


UnknownLoanAccountsSourceClean.xml
Source XML

Postnext
Charles GoldsteinSubject: XSLT and XPath Questions (New User)
Author: Charles Goldstein
Date: 23 Jan 2019 03:53 PM
Have you had a chance to try this yet?

Postnext
Ivan PedruzziSubject: XSLT and XPath Questions (New User)
Author: Ivan Pedruzzi
Date: 23 Jan 2019 04:51 PM
Ignoring for a moment the way how the for-each loops are nested which does not make sense.

These for-each statements loop on the same list of elements



The output is proper according the XSLT code.

This stylesheet outputs XML structure, it wont' output 3 lines of text as you expect


Ivan Pedruzzi
Stylus Studio Team

Postnext
Charles GoldsteinSubject: XSLT and XPath Questions (New User)
Author: Charles Goldstein
Date: 23 Jan 2019 06:52 PM
Yes, I know the for-each loops are wrong. Thatís why Iím evaluating the software for purchase :) so I can test my XPaths.
Attached is my better XLST.

Now I understand that I wonít get text output, so an XML structure is fine; I can read that. But I still expect to see values from the source XML file in the output. All Iím getting is the DefaultValue for each of the <ActivityMapVariable> sections. I know most of the sections work and I will get the proper variables. Iíve attached my output.xml file.

For example, for the AccountList section, I should have values for ProdCode, ProdDesc, AcctType, AcctId.

Can Stylus Studio do what Iím looking for?


Unknownoutput(12).xml
Output

UnknownGetAccounts.xsl
Correct XSLT

Postnext
Ivan PedruzziSubject: XSLT and XPath Questions (New User)
Author: Ivan Pedruzzi
Date: 24 Jan 2019 02:38 AM

You have bound your expression to the wrong namespace

This was your first loop

<xsl:for-each select="s:Envelope/s:Body .....

s prefix is bound to namespace http://www.w3.org/2003/05/soap-envelope
but you document Envelope and Body elements are in namespace http://schemas.xmlsoap.org/soap/envelope/

I re-wrote the first loop as following

<ActivityMapVariable>
<VariableName>AccountList</VariableName>
<Value>
<xsl:for-each select="/c:Envelope/c:Body/a:AcctSrchResponse/a:AcctSrchRecArray/a:AcctSrchRec">
<xsl:value-of select="concat('&#10;', a:ProdCode,' ',a:ProdDesc, ' ',a:AccountId/a:AcctType, ' ',a:AccountId/a:AcctId)"/>
</xsl:for-each>
</Value>
<DefaultValue>No Accounts Found</DefaultValue>
</ActivityMapVariable>

which outputs the following

<VariableName>AccountList</VariableName>
<Value>
BC Commercial Checking D 34535634
20 Special Loan L 9762798347
HE HELOC Loan HE 342345
20 Special Loan L 654987321
60 Mortgage Loan L 345345
55 Checking 55 L 99247325841</Value>
<DefaultValue>No Accounts Found</DefaultValue>
</ActivityMapVariable>

No matter which tool you are using you have to understand how XSLT works or will not succeed.
There are tons of resources on the internet that can guide you to the right direction.

Ivan Pedruzzi
Stylus Studio Team

Posttop
Charles GoldsteinSubject: XSLT and XPath Questions (New User)
Author: Charles Goldstein
Date: 24 Jan 2019 02:38 PM
Thank you for your help. As you can tell, Iím new to XSLT and hope to learn.

I followed an example I have that uses the s namespace http://www.w3.org/2003/05/soap-envelope and that code works properly in my application, but not in Stylus Studio.
When I add a c namespace using http://schemas.xmlsoap.org/soap/envelope/ I do get that output you showed in Stylus Studio.

I now see what you mean about the mismatch:
The XML file I have as input has xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" and my XSLT has xmlns:s="http://www.w3.org/2003/05/soap-envelope" . Since both of these come from the same vendor, Iím going to ask them about the mismatch.

Again, thank you very much for your help.

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.