Subject: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?
<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> </xsl:text>
<xsl:value-of select="a:ProdDesc"/><xsl:text> </xsl:text>
<xsl:value-of select="a:AccountId/a:AcctType"/><xsl:text> </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>
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.
Subject: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?
Subject: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.
Subject: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.
Subject: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.
<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.