Questions tagged [xslt-1.0]

Use this tag for questions specific to XSL Transformations version 1.0 and no other version.

W3C Recommendations:

If you are looking for help on using a particular XSLT instruction or XPath function or expression it is a good idea to check the relevant spec sections first and then to explain in your question in what way, using the information from the spec, you couldn't solve your problem; so here is a list of the various sections:

XPath 1.0 functions

String functions

Node Set functions

Number functions

Boolean functions

XSLT 1.0 elements

Online Training Material

  1. Foundations of XSLT 2 and XSLT 1 A Pluralsight course by Dimitre Novatchev
  2. Practical Transformation Using XSLT and XPath A book by G. Ken Holman
6016 questions
26
votes
2 answers

Usage of XSLT Params; &

Please explain me how best XSLT param can be used. in terms of & Sample LOC:
Siva Charan
  • 17,940
  • 9
  • 60
  • 95
22
votes
1 answer

Need variable value as element name using XSLT

I am converting one format of XML to another and I need to insert an element and name it with the value of a variable. For example, I am trying the statements below using XSLT, but I am getting an error from the processor saying that the element…
Bhuvana
  • 241
  • 1
  • 2
  • 5
19
votes
1 answer

To compare two elements(string type) in XSLT?

i am new to XSLT ,can any one please suggest to me how to compare two elements coming from xml as string their values are: Vision Operations --XML code 90 Fifth Avenue --XML code
Vineet
  • 5,029
  • 10
  • 29
  • 34
19
votes
3 answers

How to add header and footer for every pages in xsl-fo to generate pdf

please find the following xsl-fo , tried to set header and footer for every page in pdf, but got only header at first page and footer at last page. But here i needed for every page. How to perform this.
Vishnu
  • 1,029
  • 4
  • 14
  • 24
18
votes
4 answers

For loops vs. apply-templates

I have recently started using XSLT for some of my XML documents and I have some questions. I add the code below. In the code I have a template that matches ebook elements. I then want to list all the authors that wrote the book. I do it using a for…
LuckyLuke
  • 47,771
  • 85
  • 270
  • 434
18
votes
3 answers

How to copy all child nodes of any type of a template context element

I am transforming XML into HTML using XSLT. I have the following XML structure: This is some html text which should be displayed highlighted. …
monty
  • 7,888
  • 16
  • 63
  • 100
18
votes
5 answers

How do you add an image?

Situation: I have a simple XML document that contains image information. I need to transform it into HTML. However, I can't see where the open tag is and when I use the XSL code below, it shows the following error message: "Cannot write an…
Danimal
  • 7,672
  • 8
  • 47
  • 57
17
votes
4 answers

How to get maximum value under same node in xslt

I have a xml like below : HourlyReport 8 1 1
CodeGuru
  • 2,722
  • 6
  • 36
  • 52
17
votes
2 answers

Remove characters using xsl

I need to remove the following characters from a string value using xsl 1.0 *, /, \, #, %, !, @, $, (, ), & I have come up with the following: translate(translate(translate(string(//xpath/@value),'.',''),'/',''),',','') In the above approach, I…
dinesh028
  • 2,137
  • 5
  • 30
  • 47
16
votes
4 answers

How can I calculate the absolute value of a number in XSLT?

I have DifferenceInDays has a value that can be a negative or a positive number, I want to display its absolute value. How can I do this?
Mithil
  • 3,700
  • 12
  • 30
  • 41
16
votes
2 answers

Get file name using xsl

How can I get the file name using xsl 1.0? I tried but got "Fatal Error! Could not find function: base-uri"
joe
  • 16,988
  • 36
  • 94
  • 131
16
votes
3 answers

Matching elements with namespace prefix in XSLT

This is my xml input.
vignesh
  • 1,573
  • 7
  • 33
  • 60
15
votes
8 answers

Formatting string (Removing leading zeros)

I am newbie to xslt. My requirement is to transform xml file into text file as per the business specifications. I am facing an issue with one of the string formatting issue. Please help me out if you have any idea. Here is the part of input xml…
Hari
  • 159
  • 1
  • 2
  • 6
15
votes
4 answers

"greater than" works but "less than" doesn't?

This works: But this doesn't (the code inside the test doesn't execute and the following column is not rendered - for any row): I'm testing this XML and XSL…
Fabio Milheiro
  • 8,100
  • 17
  • 57
  • 96
15
votes
3 answers

Use the value of a variable in the mode of apply-templates

I want to apply a template with a mode that depends on a variable value. I get the error that the stylesheet cannot be compiled. The value of mode should be a…
maria90
  • 269
  • 4
  • 10