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

List of XSLT instructions/functions that change the context node?

Does anyone know of a list of XSLT instructions/functions that change the context node? For example, instruction like for-each is one of them.
Pacerier
  • 86,231
  • 106
  • 366
  • 634
13
votes
4 answers

Remove Elements and/or Attributes by Name per XSL Parameters

The following does the job of removing unwanted elements and attributes by name ("removeMe" in this example) from an XML file:
Witman
  • 1,488
  • 2
  • 15
  • 19
13
votes
3 answers

XSLT: If tag exists, apply template; if not, choose static value

I am new to XSLT in general so please bear with me... With that in mind, what I am trying to do is check for a certain tag in the XML. If it is there I want to apply a template. If not, I want to add it (as a blank value). Basically always…
Issa Fram
  • 2,556
  • 7
  • 33
  • 63
13
votes
4 answers

Interpreting newlines with xsl:text?

I have an XSL stylesheet with content in an xsl:text node like this: foo bar baz The stylesheet itself is a text file with "unix-style" newline line terminators. I invoke this stylesheet on Windows as well as unix-like…
Greg Mattes
  • 33,090
  • 15
  • 73
  • 105
13
votes
9 answers

Convert First character of each word to upper case

I have a String and I need to convert the first letter of each word to upper case and rest to lower case using xsl, For example, Input String= dInEsh sAchdeV kApil Muk Desired Output String= Dinesh Sachdev Kapil Muk Although, I know I have to use…
dinesh028
  • 2,137
  • 5
  • 30
  • 47
13
votes
2 answers

how to make xsl tokenize work

I have a huge xsl file but the section where i use "tokenize" to parse through a comma separated string is throwing an error. For simplicity purposes I have broke it down to just test the tokenize piece only and cannot seem to make any progress. I…
user858697
  • 133
  • 1
  • 1
  • 8
12
votes
5 answers

Padding number with leading zeros in XSLT 1.0

We have a number in XML that can go up to 3 digits in a large XML file that has to be converted to fixed length text for loading into another system. I need to pad this with leading zeros to a length of 15 in the output (which is fixed length…
Our Man in Bananas
  • 5,809
  • 21
  • 91
  • 148
12
votes
1 answer

What this stands for in xsl? match="@*|node()"

Can anyone explain what this means in xsl? Exactly what does each expression stands for
sajay
  • 295
  • 1
  • 2
  • 11
11
votes
4 answers

lower case the first character of a string using only xslt 1.0

I have seen patterns for translating a string into lower (or upper case) using the translate function for folks stuck using xslt 1.0. Is there a elegant way of just making the first letter of a string lowercase? TestCase => testCase
Atlas1j
  • 2,442
  • 3
  • 27
  • 35
11
votes
2 answers

Multiply 2 numbers and then sum

I am having a difficult time trying to do something that seems like it should be really easy to do. I basically want to multiply 2 numbers in a node and then sum the total of those numbers for all the nodes. Here is the XSLT code I have…
Dave
11
votes
8 answers

How to convert json to xml using xslt

How would you convert JSON to XML? Consider: { "Order": { "InvestmentAccount": { "AccountNumber": "10" }, "Parcel": { "Limit": "0", "ExpiryDate": "1900-01-01T00:00:00", "Asset": [ { …
user1731504
  • 159
  • 1
  • 3
  • 12
11
votes
3 answers

Select node based on child node value in XSLT

I would like to select only those node where child node value matches a certain value. Here is my orig XML: This is my orig XML AAA A B BBB
Rahul
  • 137
  • 1
  • 1
  • 5
11
votes
2 answers

XSLT: Set multiple variables depending on condition

I want to assign multiple variables depending on one condition environment. I know how to do that for only one variable:
Jost
  • 5,948
  • 8
  • 42
  • 72
10
votes
2 answers

can we use dynamic variable name in the select statement in xslt?

I wanted to use a dynamic variable name in the select statement in xslt.
dhinu
  • 135
  • 1
  • 2
  • 10
10
votes
2 answers

Safari XSLT engine loses namespace on attributes

I have an XSLT that matches certain attributes, and puts them in a different namespace. Here is a simplified version:
murrayju
  • 1,752
  • 17
  • 21