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
350
votes
14 answers

Check if a string is null or empty in XSLT

How can I check if a value is null or empty with XSL? For example, if categoryName is empty? I'm using a when choosing construct. For example:
raklos
  • 28,027
  • 60
  • 183
  • 301
113
votes
1 answer

Using copy-of with document() to add SVGs to XHTML output

While processing my XML, I'm trying to copy an SVG file referenced from an href attribute directly into my output HTML with the following line: The copy-namespaces should not be…
jrhooker
  • 1,373
  • 2
  • 11
  • 14
94
votes
6 answers

XSLT string replace

I don't really know XSL but I need to fix this code, I have reduced it to make it simpler. I am getting this error Invalid XSLT/XPath function on this line This is the…
Aximili
  • 28,626
  • 56
  • 157
  • 216
89
votes
3 answers

How to create a boolean value?

I am totally new to XSLT and can't work out where I am going wrong with the following code. variable is true It is always returning true when it is meant to be…
sydlawrence
  • 1,882
  • 2
  • 17
  • 21
81
votes
3 answers

Can one give me the example for "mode" of template in xsl?

In What is the meaning of mode? I searched many many resource, but i couldn't find example for that. So can anybody explain with an example?
Venkat
  • 20,802
  • 26
  • 75
  • 84
78
votes
2 answers

Why does XSLT output all text by default?

Hi I had performed a transformation which drops a tag if it is null. I wanted to check whether my transformation is working fine, so instead of checking it manually, I wrote one more XSLT code which just checks the presence of that particular tag in…
Rookie Programmer Aravind
  • 11,952
  • 23
  • 81
  • 114
75
votes
2 answers

How to remove elements from xml using xslt with stylesheet and xsltproc?

I have a lot of XML files which have something of the form: Which I want to be removed from the file. Using an XSLT stylesheet and the Linux command-line utility xsltproc, how could I do this? By this point in…
Grundlefleck
  • 124,925
  • 25
  • 94
  • 111
67
votes
8 answers

XSLT: How to change an attribute value during ?

I have an XML document, and I want to change the values for one of the attributes. First I copied everything from input to output using:
tomato
  • 5,644
  • 13
  • 43
  • 48
66
votes
3 answers

XSL: Meaning of `match="/"` for `xsl:template`

I am just learning XML and how to use XSL files. In an XSL file I found the following term: xsl:template match="/" What does this stand for? And what could I use instead of the /? Could I write table or any other HTML tag instead of /?
Pat
  • 677
  • 1
  • 6
  • 3
64
votes
2 answers

Upgrading XSLT 1.0 to XSLT 2.0

What is involved in upgrading from XSLT 1.0 to 2.0? 1 - What are the possible reasons for upgrading? 2 - What are the possible reasons for NOT upgrading? 3 - And finally, what are the steps to upgrading? I'm hoping for an executive summary--the…
Witman
  • 1,488
  • 2
  • 15
  • 19
43
votes
2 answers

xsl: how to split strings?

I want to split an address on semicolons (;) into rows separated by
: e.g. if address=123 Elm Street, I want to output 123 Elm Street, but if address=123 Elm Street;PO Box 222, I want to output 123 Elm Street
PO Box 222 and if…
Jason S
  • 184,598
  • 164
  • 608
  • 970
41
votes
4 answers

XSLT xsl:sequence. What is it good for..?

I know the following question is a little bit of beginners but I need your help to understand a basic concept. I would like to say first that I'm a XSLT programmer for 3 years and yet there are some new and quite basics things I've been learning…
user1942476
  • 435
  • 1
  • 5
  • 8
32
votes
4 answers

Need to remove from the xml

Hi i am generating a xml by appying the xsl to a xml input. I need the output without this part "" input--xml
shaiksha
  • 993
  • 5
  • 17
  • 35
29
votes
2 answers

Create node set and pass as a parameter

Using XSLT 1.0, I'm trying to essentially create a small node set and then pass it as a parameter to a template, something like the following:
John J. Camilleri
  • 4,171
  • 5
  • 31
  • 41
27
votes
2 answers

xslt 1.0 string replace function

I have a string "aa::bb::aa" and need to turn it in to "aa, bb, aa" I have tried translate(string,':',', ') but this returns "aa,,bb,,aa" How can this be done.
Paul
  • 1,375
  • 4
  • 16
  • 29
1
2 3
99 100