xslt-1.0

In XPath 1.0, how can I test whether a string with length 1 falls between two others codepoint-wise?

Given a document containing these tags, how can I tell whether " " < "H" < "z" in the document's encoding? I'm trying to do this in XPath 1.0. <text>H</text> <range> <from>&#x20;</from> <to>z</to> </range> I might even be able to get away with using contains(), but then how would I create a string containing the characters from "...

Processing cyclic dependencies with XSLT

I’m processing an XML file that, simplified, looks something like this: <resources> <resource id="a"> <dependency idref="b"/> <!-- some other stuff --> </resource> <resource id="b"> <!-- some other stuff --> </resource> </resources> The XSLT stylesheet must process a particular resource that we’re interested in, wh...

XSL processor stack has overflowed - can't understand why

Hello guys, I'm trying to conditionally display the content of HTML page depending if a document being generated for a recognised company or not. However, the transformation doesn't work and I can't understand why :( I use MSXML3.0 as transformer and oXygen as IDE, which gives the errors I presented below. What I do is to construct a ...

get preceding-sibling relative to a node set

I query and sort alphabetically a bunch of XML elements, to which I apply a template, to produce an alphabetical list. I'd like to prefix the nodes with the same initial by this very initial: A Abe Amel Andrew B Bobby Benny ... The preceding-sibling axis is relative to the document, not the nodeset. What can I do? ...

Need an XSLT 1.0 solution for what would be a relatively simple regular expression.

I've got a field in my xml that looks like this (some examples): <ViolationCharged>VTL0180 0D 0I0</ViolationCharged> <ViolationCharged>VTL0180-C 02A 0I0</ViolationCharged> <ViolationCharged>VTL1180 B 0I0</ViolationCharged> I need to turn it into something that looks like this: <Violation>VTL180.0D</Violation> <Vi...

How to not output whitespace in xslt for an element that has attributes

I have an xslt document and I want to output an anchor (a) tag with some attributes who's values depend on other things.. Thus, I use the xsl:attribute tag with a choose/if underneath it (or vice-versa).. So my code looks like this: <a href="/somepage.html"> <xsl:if test="current_page='this_page'"> <xsl:attribute name='class'>activ...

XSLT nested sort / for-each

I am trying to figure out the best way to perform a nested for-each & sort. For example my XSLT below performs the following: Selects a node set. Sorts by Date attribute. Performs position() to pull 4 nodes. Now, the next part is what I am trying to figure out. After step 3 I need to sort by the Date attribute again, but thi...

How do I select all comment nodes in an XML file?

Simple question. I have an XML file with a few dozens of comment blocks. This is being transformed by a stylesheet to generate an HTML page. However, the comments are ignored with this. But at the bottom of the generated HTML I would like to have a list of all comments within the XML file. Is that even possible, without the use of anythi...

Detect if an XML file contains a specific namespace

Again a simple thing. I have a stylesheet that parses XML and XSL files. Basically, it tries to detect if the XML is a stylesheet with: <xsl:if test="count(//xsl:template)!=0"> It does indeed detect stylesheets. It has problems with XML files, though, which generate an "Undefined namespace prefix - 'xsl'" error. (In XmlSpy. Similar er...

Namespace output with XSLT 1.0 causing problems

Hi guys, i'm using XSLT 1.0 to transform some XML. I'm not quite sure the best way to explain this, so will use some examples. My input XML contains a specialization, using the xsi:type declaration. See the Payload node: <ns0:RootNode xmlns:ns0="namespace1" xmlns:ns1="namespace2" xmlns:xsi="http://www.w3.org/2001/XMLSchema"&gt; <...

List every node in an XML file.

Simple situation... With any random XML file, I want to create a list of every node that it contains, but without any duplicates! So something like: <root name="example"> <child id="1"> <grandchild/> </child> <child id="2"/> <child id="3"/> </root> Is translated to: /root /root/@name /root/child /root/child/@id /root/chil...