Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 8th, 2016, 01:59 PM
Registered User
 
Join Date: Jan 2016
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs down Comparing 2 variables in XSLT

I am having an issue with following XSLT code:

<xsl:when test="$myissueNum=$mySWRissueNum">
<xsl:for-each select="./elements/element">
<xsl:variable name="myfile" select="./@location" />

<xsl:value-of select="$myfile"/><br/>
</xsl:for-each>
<br/>
</xsl:when>

I tried to use IF statement instead with the same result. Basically it is error out on comparing one variable to another variable. If I change right variable to a value, it will start working, but unfortunately I do need both variables to stay variables because this code is with it another loop.

<xsl:for-each select="/report/acResponse/issues/issue">
<xsl:variable name="myissueNum" select="./issueNum" />

That loop basically goes through the list of issueNum

And that look within another loop:

<xsl:for-each select="/report/SWRINFO/issues/issue">

which goes through mySWRissueNum.

This suppose to create a table. A list of files that belong to a specific issue and that table is within another table, the list of issues. Each issue has the list of files.
I am not quiet sure how to make this work. This code worked just fine in Internet Explorer 9 but in IE 11 it is no longer working.

If I remove that when function, it shows style of xml fine, but there is no list of files shown for each issue. The XML generated automatically from 3rd party tool. I don't have much control over XML format. The XSLT should work with XML created for any type of issues in the tool.
 
Old January 8th, 2016, 03:46 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

What error message do you get?
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old January 8th, 2016, 05:07 PM
Registered User
 
Join Date: Jan 2016
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There is no error message in IE 11. It just show some data, not completely, but without format. Kind of in one line. In Firefox it shows this error: "Error during XSLT transformation: An unknown error has occurred ()".
I know for sure that this particular Chose When function is failing, because if I remove it, entire page shows up just fine. But that particular function is gone, which makes entire page kind of obsolete. The only reason that report generated is to show dependency of files and issues.
I am now trying to work on alternative way to show the data, as I can't find the way to make it work with XLST, but that may take a while.
 
Old January 8th, 2016, 05:57 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You never mentioned that you were running in the browser. That's the worst possible place to test XSLT code, but if you have to, then running XSLT with the Firefox debugging environment enabled can work reasonably well. But it's years since I've done it, so I can't help on the details.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing two variables by using = operator in xsl saurabh_inblore XSLT 1 February 2nd, 2007 05:22 AM
Comparing Dates in XSLT kwilliams XSLT 7 December 1st, 2005 08:49 PM
Comparing floating point variables patpicos BOOK: Beginning Java 2, JDK 5 Edition 0 February 1st, 2005 12:37 AM
Stupid Problem... on comparing variables! Varg_88 Classic ASP Basics 1 December 11th, 2004 06:00 PM
variables in xslt will.richardson XSLT 1 September 24th, 2003 01:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.