Questions tagged [xsl-choose]

Tests multiple conditions in conjunction with the `` and `` elements.

The <xsl:choose> element is used in conjunction with <xsl:when> and <xsl:otherwise> to express multiple conditional tests.

If no <xsl:when> is true, the content of <xsl:otherwise> is processed.

If no <xsl:when> is true, and no <xsl:otherwise> element is present, nothing is created.

Syntax

<xsl:choose>

  <!-- Content:(xsl:when+,xsl:otherwise?) -->

</xsl:choose> 
27 questions
27
votes
1 answer

switch case in XSL

I have a loop with the same tags to load content in ten cells but has a difference div title and background image, so I wonder is there any way to use the switch case just to put correct div title when I do for-each to load content for each cells in…
8
votes
3 answers

How to check if variable is Null or empty in XSLT?

I definded the following variables:
Oleg_08
  • 447
  • 1
  • 4
  • 23
2
votes
3 answers

XSLT conditional statement options

In an attempt to learn more about the possibilities of XSLT I'm wondering if the is a better way to write this conditional code using a different approach. It simply looks for the href in the first instance and if a href input is present the…
ozmo
  • 29
  • 4
2
votes
5 answers

XSLT - How to refer to a current node value using xsl:choose?

I try to create a variable, which I can use in a later template: gray red
FelHa
  • 1,043
  • 11
  • 24
2
votes
2 answers

xsl:sort does not work together with xsl:choose or if

Im going crazy on this XSL problem i have! The thing is that i want to sort newspaper after what is choosen in a FORM. If $sort_newspaper = 'name' and it should sort after name ( )... but... it does not work if the…
Eva Linnea
  • 23
  • 1
  • 3
2
votes
2 answers

PHP XSL Conditional Statement (CHOOSE, WHEN, IF, OTHERWISE) Causes 500 Internal Server Error

Here's the problem. I am taking returned XML data that is returned from a web application and processing it into HTML through XSLT for the user to see. This works flawlessly on my local WAMP server (Apache 2.2.21, PHP 5.3.8, libxml 2.7.8, libxslt…
Jeremy Duncan
  • 33
  • 1
  • 6
1
vote
3 answers

XSLT XPATH filter expression during XSL:Choose

I have the following XML and need to filter conditionally on whether or not UnitOfMeasure has a value. If the first UnitOfMeasure where ID = 'AcceptanceCriterionValue1' contains a string with a length greater than 0, I should select that value.…
1
vote
1 answer

Run a xsl:choose using the result of a formula

Creating an XSL to translate XML into Excel. Part of that is a formula which performs a lookup on another worksheet. However, I want to transform/translate the return, so I figured an xsl:choose would be best. But I don't know how to reference my…
Sean Perryman
  • 29
  • 1
  • 1
  • 7
1
vote
2 answers

xslt keep multiple variables in scope depending on a single test

I have many variables and only two cases. My original approach goes out of scope: x
n611x007
  • 8,952
  • 8
  • 59
  • 102
1
vote
1 answer

XSL Choose situation not pulling data correctly

I am trying to do an XSL choose to populate an select box. There will be more options in the box once I have this one working I just need to get this working first. It is loading properly it just isn't pulling the e:name so the option box is…
user3614312
  • 105
  • 1
  • 1
  • 5
1
vote
1 answer

xsl variable is not working in xsl choose

This "$PAGE_SCOPE[title]" will display the title of the page i want to display different headlines based on the title so i am trying to get the page title in a variable, this variable is displaying the title in the paragraph tag but it's not working…
1
vote
1 answer

xsl wrap a choose result in a div tag

How do you wrap the "when" and "otherwise" results in a tag? In my example below I tried adding a the div but it ends up wrapping each result.
1
vote
1 answer

XSL Transform : Choose block not choosing right variable

I am working on an xsl document which keeps loosing lines of an address. I had it fixed but seem to have broken it trying to fix an issue associated with the fix. Here is a sample from my code: .
a.hrdie
  • 716
  • 2
  • 14
  • 35
1
vote
1 answer

with xslt how do I use choose/when to remove elements from document

Here is my example document I am looking to remove the "c" element only when the flag attribute on b is 'bar'. Ie if flag='foo' the "c" element should not be removed. I do not currently have an xsl…
cspeter8
  • 101
  • 5
1
vote
1 answer

With XSLT, how can I use this if-test with an array, when search element is returned by a template call inside the for loop?

I think this simple example might ask the question a lot more clearly. I have an input file with multiple products. There are different types of product (2 types with 2 product IDs is fine enough for this example), but the input will have many…
codesforcoffee
  • 179
  • 5
  • 11
1
2