Questions tagged [apply-templates]

90 questions
133
votes
4 answers

What are the differences between 'call-template' and 'apply-templates' in XSL?

I am new in XSLT so I'm little bit confused about the two tags, and So can you list out the difference between them?
Venkat
  • 20,802
  • 26
  • 75
  • 84
20
votes
3 answers

XSL named parameter 'with-param' using 'apply-templates'

My questions are at the bottom of this post, if you wish to read them before the full explanation. I'm converting an XML document to a pretty web page using XSL, and am having trouble with correctly passing a variable. I have many xsl:templates…
KevenK
  • 2,975
  • 3
  • 26
  • 33
9
votes
3 answers

How to select first node only in xslt

My XML provides me with multiple images assigned to different mmids: A 22404 FILE ANOTHER 22404 FILE
Richard Tinkler
  • 1,635
  • 3
  • 21
  • 41
7
votes
4 answers

How do I apply templates to each selected node in a for-each?

I know I'm missing something here. In the XSLT transformation below, the actual result doesn't match the desired result. Inside the for-each, I want to apply the match="track" template to each selected track element. If I've understood XSLT…
Jakob
  • 2,588
  • 5
  • 27
  • 34
5
votes
2 answers

XSLT apply-templates inside for-each

I have an XSLT like below, and want to use apply-templates inside the xsl:for-each element so I don't have to repeat the element with the informations of the "cliente" XML element. I'm trying but with no success to create a xsl:template and put…
delta
  • 185
  • 2
  • 13
3
votes
4 answers

XSLT 1.0: apply-templates and template mode

I have the following XML: RECORD_ID ENTITY_CODE USER_CODE RECORD_DATE
Peter
  • 1,786
  • 4
  • 21
  • 40
3
votes
3 answers

apply-templates outputs content more times than expected

I'm new to XSLT and I can't understand why the root get processed twice (at least this is my interpretation of this output). EDIT: (I'm using Saxon-HE with XSLT 2.0) but also tested with several online processes, getting always the same result. XSLT…
villasv
  • 6,304
  • 2
  • 44
  • 78
3
votes
3 answers

XSLT: Apply templates with conditional parameters?

I'd like to apply a template with different parameters based on the result of a conditional. Something like this:
conciliator
  • 6,078
  • 6
  • 41
  • 66
2
votes
1 answer

XSLT apply templates and string manipulate

I have some XML like so:

(5) The Secretary of State shall appoint such as....

I can't change the XML and I need to strip out the (5) at the start…
user888734
  • 3,797
  • 5
  • 36
  • 67
2
votes
2 answers

Rendering different templates for the same XML element, at same level

XML: el1 el2 el1 el2 Trying to generate to apply two different templates for the…
Loser Coder
  • 2,338
  • 8
  • 42
  • 66
2
votes
2 answers

XSLT apply-templates recursiveness of doom!

I have to following XML document structure: Do you like cake?
Dave
  • 4,356
  • 4
  • 37
  • 40
2
votes
3 answers

Apply templates to a substring in XSLT

Imagine that my XML file looks like this: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua... …
nikname
  • 21
  • 1
  • 6
2
votes
2 answers

XSL apply templates not working...could be XPath error

I have converted mny stylesheet to use apply templates instead of call templates and it worked fine for my other styesheet, which was more complicated, but this one doesn't seem to work even thought it is a much simpler template. All that it outputs…
AdRock
  • 2,959
  • 10
  • 66
  • 106
2
votes
2 answers

Optimisation for a set of tags

How it is possible to reduce this record?
Kalinin
  • 2,489
  • 8
  • 37
  • 49
2
votes
1 answer

Duplicate node() for every token in grandchild and replace element text of the grandchild by token in XSLT 1.0?

My (simplified) input XML looks like this: 16 metal, glass
CodeManX
  • 11,159
  • 5
  • 49
  • 70
1
2 3 4 5 6