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
7
votes
3 answers

How to convert XML to HTML using XSLT in Java

I want to convert XML file into HTML file with help of XSLT. But I am getting an error i.e. javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException:…
user2960161
  • 71
  • 1
  • 1
  • 2
7
votes
5 answers

XSLT Ternary "If" Operator?

I am making use of XSLT and XML to produce an output document. What I have in the data (in XML form over which I have no control) is the following: 4 I need to use these in calculations. I see that…
swshaun
  • 384
  • 1
  • 4
  • 12
7
votes
4 answers

XSLT 1.0 adding values together from multiple nodes

Say I have the following XML 100 200 300 and the following XSLT It produces the following output 600 however, when one of the nodes is blank …
james31rock
  • 2,615
  • 2
  • 20
  • 25
7
votes
2 answers

Call XSLT template and save all output to variable

I want to call and template and save the output to a variable. I want to save ALL of the output including HTML markup, but that's not what happens. For example, take this simple XSLT:
rwkiii
  • 5,716
  • 18
  • 65
  • 114
7
votes
4 answers

How to compare strings with Xpath 1.0?

I am experiiencing an issue with the < operator on strings in Xpath 1.0. This simple Xpath expression 'A' < 'B' (or the equivalent 'A' < 'B') did not evaluate to true in my xslt run in libxslt (which is an XSLT 1.0 engine). I checked in XML…
Maestro13
  • 3,656
  • 8
  • 42
  • 72
7
votes
2 answers

"Regular expression"-style replace in XSLT 1.0

I need to perform a find and replace using XSLT 1.0 which is really suited to regular expressions. Unfortunately these aren't available in 1.0 and I'm also unable to use any extension libraries such as EXSLT due to security settings I can't…
Alex Angas
  • 59,219
  • 41
  • 137
  • 210
7
votes
2 answers

find next-to-last node with xpath

I have a XML document with chapters and nested sections. I am trying to find, for any section, the first second-level section ancestor. That is the next-to-last section in the ancestor-or-self axis. pseudo-code: mychapter
Tim
  • 1,013
  • 3
  • 17
  • 36
7
votes
2 answers

How to handle duplicate imports in XSLT?

A warning is thrown whenever the same file is imported multiple times in an XSL transformation. Usually something along the lines of Stylesheet module…
Riplikash
  • 843
  • 8
  • 27
6
votes
2 answers

Sorting by ID and then by timestamp within the same node

I have a very particular issue regarding sorting with XSL 1.0 (and only 1.0 - I'm using .Net Parser). Here is my xml : .... 1 20111208165819
bosam
  • 168
  • 6
6
votes
3 answers

Get first child node in XSLT using local-name()

Assume we have this simple xml ... </book> <book> <author/> <title/> </book> </books> I'm using this xpath to get the elements of the first book…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/xml" class="post-tag grid--cell" title="show questions tagged 'xml'" rel="tag">xml</a> <a href="../../questions/tagged/xslt" class="post-tag grid--cell" title="show questions tagged 'xslt'" rel="tag">xslt</a> <a href="../../questions/tagged/xpath" class="post-tag grid--cell" title="show questions tagged 'xpath'" rel="tag">xpath</a> <a href="../../questions/tagged/xslt-1.0" class="post-tag grid--cell" title="show questions tagged 'xslt-1.0'" rel="tag">xslt-1.0</a> <a href="../../questions/tagged/xalan" class="post-tag grid--cell" title="show questions tagged 'xalan'" rel="tag">xalan</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Nov 08 '11 at 23:03">asked Nov 08 '11 at 23:03</time> <a href="../../users/791406/raffian" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/791406.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="raffian" /> </a> <div class="s-user-card--info"> <a href="../../users/791406/raffian" class="s-user-card--link">raffian</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">31,267</li> <li class="s-award-bling s-award-bling__gold" title="26 gold badges">26</li> <li class="s-award-bling s-award-bling__silver" title="103 silver badges">103</li> <li class="s-award-bling s-award-bling__bronze" title="174 bronze badges">174</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-7005855"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>6</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>1</strong> answer </div> </div> </div> <div class="summary"> <h3><a href="../../questions/7005855/what-xslt-instructions-change-the-current-node-other-than-for-each" class="question-hyperlink">What XSLT instructions change the current node other than for-each?</a></h3> <div class="excerpt">I have this input: <school> <faculty> <area> <name>F1A1</name> </area> <area> <name>F1A2</name> </area> <area> <name>F1A3</name> </area> </faculty> …</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/xml" class="post-tag grid--cell" title="show questions tagged 'xml'" rel="tag">xml</a> <a href="../../questions/tagged/xslt" class="post-tag grid--cell" title="show questions tagged 'xslt'" rel="tag">xslt</a> <a href="../../questions/tagged/xslt-2.0" class="post-tag grid--cell" title="show questions tagged 'xslt-2.0'" rel="tag">xslt-2.0</a> <a href="../../questions/tagged/xslt-1.0" class="post-tag grid--cell" title="show questions tagged 'xslt-1.0'" rel="tag">xslt-1.0</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Aug 10 '11 at 04:18">asked Aug 10 '11 at 04:18</time> <a href="../../users/632951/pacerier" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/632951.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Pacerier" /> </a> <div class="s-user-card--info"> <a href="../../users/632951/pacerier" class="s-user-card--link">Pacerier</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">86,231</li> <li class="s-award-bling s-award-bling__gold" title="106 gold badges">106</li> <li class="s-award-bling s-award-bling__silver" title="366 silver badges">366</li> <li class="s-award-bling s-award-bling__bronze" title="634 bronze badges">634</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-6918938"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>6</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>2</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/6918938/warning-failed-to-load-external-entity" class="question-hyperlink">warning: failed to load external entity</a></h3> <div class="excerpt">I am processing an XML document from within directory A in X (X -> A) using an XSLT stylesheet that uses the document() function to dynamically build a directory path to another XML document in N... this part works like a charm. The XML document in…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/xslt" class="post-tag grid--cell" title="show questions tagged 'xslt'" rel="tag">xslt</a> <a href="../../questions/tagged/xslt-1.0" class="post-tag grid--cell" title="show questions tagged 'xslt-1.0'" rel="tag">xslt-1.0</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Aug 02 '11 at 21:33">asked Aug 02 '11 at 21:33</time> <a href="../../users/664424/lightonphiri" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/664424.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="lightonphiri" /> </a> <div class="s-user-card--info"> <a href="../../users/664424/lightonphiri" class="s-user-card--link">lightonphiri</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">782</li> <li class="s-award-bling s-award-bling__gold" title="2 gold badges">2</li> <li class="s-award-bling s-award-bling__silver" title="14 silver badges">14</li> <li class="s-award-bling s-award-bling__bronze" title="29 bronze badges">29</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-6596256"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>6</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>1</strong> answer </div> </div> </div> <div class="summary"> <h3><a href="../../questions/6596256/alternate-sorted-nodes-in-xslt-1-0-without-extension-function" class="question-hyperlink">alternate sorted nodes in XSLT 1.0 without extension function</a></h3> <div class="excerpt">This a very similar question as XSL: Transforming xml into a sorted multicolumn html table But (unfortunately) there's an extra requirement: it should be XSLT 1.0 without extension functions, i.e. without using the node-set function. This is my…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/xslt" class="post-tag grid--cell" title="show questions tagged 'xslt'" rel="tag">xslt</a> <a href="../../questions/tagged/xslt-1.0" class="post-tag grid--cell" title="show questions tagged 'xslt-1.0'" rel="tag">xslt-1.0</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jul 06 '11 at 12:20">asked Jul 06 '11 at 12:20</time> <a href="../../users/827779/ziggy" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/827779.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Ziggy" /> </a> <div class="s-user-card--info"> <a href="../../users/827779/ziggy" class="s-user-card--link">Ziggy</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">83</li> <li class="s-award-bling s-award-bling__bronze" title="8 bronze badges">8</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-6554488"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>6</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>3</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/6554488/how-to-get-the-nearest-ancestor-or-child-of-an-ancestor-with-xpath" class="question-hyperlink">How to get the nearest ancestor or child of an ancestor with xpath</a></h3> <div class="excerpt">Look at <bookmark/>. The desired output I want is the id with value 5 <xsl:value-of select="//bookmark/ancestor::*[@id][1]/@id"/> only gives me 4 <?xml version="1.0" encoding="UTF-8"?> <content> <section id="1"> <section id="2"/> …</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/xslt" class="post-tag grid--cell" title="show questions tagged 'xslt'" rel="tag">xslt</a> <a href="../../questions/tagged/xpath" class="post-tag grid--cell" title="show questions tagged 'xpath'" rel="tag">xpath</a> <a href="../../questions/tagged/xslt-1.0" class="post-tag grid--cell" title="show questions tagged 'xslt-1.0'" rel="tag">xslt-1.0</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jul 02 '11 at 01:02">asked Jul 02 '11 at 01:02</time> <a href="../../users/756056/therealmarv" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/756056.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="therealmarv" /> </a> <div class="s-user-card--info"> <a href="../../users/756056/therealmarv" class="s-user-card--link">therealmarv</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">3,692</li> <li class="s-award-bling s-award-bling__gold" title="4 gold badges">4</li> <li class="s-award-bling s-award-bling__silver" title="24 silver badges">24</li> <li class="s-award-bling s-award-bling__bronze" title="42 bronze badges">42</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-4684664"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>6</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>1</strong> answer </div> </div> </div> <div class="summary"> <h3><a href="../../questions/4684664/sorting-with-xslt" class="question-hyperlink">Sorting with XSLT</a></h3> <div class="excerpt">UPDATE - New code at the bottom I'm trying to figure out how to use the sort function to pull the most recent record from some XML data. I'm very new to using XSLT and am running into a bunch of problems. Here's an example of my data... <content…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/xml" class="post-tag grid--cell" title="show questions tagged 'xml'" rel="tag">xml</a> <a href="../../questions/tagged/xslt" class="post-tag grid--cell" title="show questions tagged 'xslt'" rel="tag">xslt</a> <a href="../../questions/tagged/sorting" class="post-tag grid--cell" title="show questions tagged 'sorting'" rel="tag">sorting</a> <a href="../../questions/tagged/xslt-1.0" class="post-tag grid--cell" title="show questions tagged 'xslt-1.0'" rel="tag">xslt-1.0</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jan 13 '11 at 20:03">asked Jan 13 '11 at 20:03</time> <a href="../../users/574814/dscl" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/574814.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="dscl" /> </a> <div class="s-user-card--info"> <a href="../../users/574814/dscl" class="s-user-card--link">dscl</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">1,616</li> <li class="s-award-bling s-award-bling__gold" title="7 gold badges">7</li> <li class="s-award-bling s-award-bling__silver" title="28 silver badges">28</li> <li class="s-award-bling s-award-bling__bronze" title="48 bronze badges">48</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="s-pagination pager fr"> <a class="s-pagination--item" href="../../questions/tagged/xslt-1.0_page=4" rel="prev" title="Go to page 4">Prev </a> <a class="s-pagination--item" href="../../questions/tagged/xslt-1.0_page=1" rel="" title="Go to page 1">1</a> <a class="s-pagination--item" href="../../questions/tagged/xslt-1.0_page=2" rel="" title="Go to page 2">2</a> <a class="s-pagination--item" href="../../questions/tagged/xslt-1.0_page=3" rel="" title="Go to page 3">3</a> <div class="s-pagination--item s-pagination--item__clear">…</div> <a class="s-pagination--item" href="../../questions/tagged/xslt-1.0_page=99" rel="" title="Go to page 99">99</a> <a class="s-pagination--item" href="../../questions/tagged/xslt-1.0_page=100" rel="" title="Go to page 100">100</a> <a class="s-pagination--item" href="../../questions/tagged/xslt-1.0_page=6" rel="next" title="Go to page 6"> Next</a> </div> </div> </div> </div> </div> <script src="../../static/js/stack-icons.js"></script> <script src="../../static/js/fromnow.js"></script> </body> </html>