xslt

XSLT to Select Desired Elements When Nested In Not-Desired Elements

What XSLT would I use to extract some nodes to output, ignoring others, when the nodes to be be extracted are some times nested nodes to be ignored? Consider: <alpha_top>This prints. <beta>This doesn't. <alpha_bottom>This too prints.</alpha_bottom> </beta> </alpha_top> I want a transform that produces: <alpha_top>This prints...

Resource Explaining XSLT Processing Path

What is the best resource to learn the principles by which XSLT applies template rules? Questions like this seem like they should be relatively easy to answer, and certainly so after some study. I'm almost embarrassed to post them. But I have looked at Kay's XSLT Programmer's Reference, the XSLT Cookbook, and Learning XSLT, and I st...

How to stop XSL unescaping URLs

I am using XSL to display an XML representation of an email message in browsers. Email attachments are stored in separate files to the main email XML file, and so I want the resulting web page for the email to contain a link to its attachments. However some of the attachments are email messages themselves, and may have been forwards or ...

Xslt distinct select / Group by

<statisticItems> <statisticItem id="1" frontendGroupId="2336" caseId="50264" /> <statisticItem id="2" frontendGroupId="2336" caseId="50264" /> <statisticItem id="3" frontendGroupId="2337" caseId="50265" /> <statisticItem id="4" frontendGroupId="2337" caseId="50266" /> <statisticItem id="5" frontendGroupId="2337" c...

Substring,string-length function in xslt

Basically I have a string created from a loop separated by commas eg. A,B,C, I want to get rid of the last comma. <xsl:variable name="myConcatString"> <xsl:for-each select="valueinElement"> <xsl:value-of select="@attributeValue"/>, </xsl:for-each> </xsl:variable> <xsl:variable name="valueLength" select="string-length($my...

xslt sorting

I have a list of items being returned in xml. each item has various elements. one of the elements is "Position" which takes a value between 0-6 if Position is 0 then the item should not be shown, but if its between 1 and 6 I need it to be shown. how can i do the xslt so that it will list the items by order of "Position" ...

extract text using xslt

one of my elements from xml is an image and when i do <xsl:value-of select="MyImage" /> it outputs this as the data <img alt="" border=0 src="/PublishingImage/myPic.jpg" style="border:0px solid"> using xslt can i extract just the src bit so that i have /PublishingImage/myPic.jpg without the quotes. ...

inserting XML elements in freemarker template using XPath

I'm using freemarker to do some XSLT-like transformations. I've created a working template, but it's ugly (see the example). But some of the elements aren't being transfomred at all. Is there a way I can use XPath expressions to insert entire elements into the XML? For example, <Root> <A> <B>bb</B> <c>cc</c> </A> <D> etc </D> <...

[XSLT] Creating a recursive XSL:If statement?

I'm trying to set up an XSL:IF statement that only shows entries that have a node that falls between two values. Simple enough, right? It's just a if greater than and if less than. Problem is, instead of testing it against one node I need to test it against up to 52. Let's say I have some XML that looks like this: <container> <entr...

Filtering a datasource by range in the Symphony CMS

I'm currently working on a website and have run into a major problem. In a recent question I asked how to filter my XML with XSLT based on the content of a series of XML nodes. The end result was this: <xsl:if test="listings/entry[available-weeks/item[number(.) &gt;= {$url-min} and number(.) &lt;= {$url-max}]]"> //my listings show h...

Passing Formatted Text Through XSLT

I have formatted text (with newlines, tabs, etc.) coming in from a Telnet connection. I have a python script that manages the Telnet connection and embeds the Telnet response in XML that then gets passed through an XSLT transform. How do I pass that XML through the transform without losing the original formatting? I have access to the...

Is this possible using XSLT?

I have 2 xml files. I would like wite xsl program that eliminates (and create an new xml) all the nodes of SearchApp_MA_Request from SearchApp_LA_Request when Field4 and field5 and field6 are same in both files. SearchApp_LA_Request.xml <Request> <Rows> <Row1> <Field1>Item1</Field1> <Field2>I...

How to implement Carriage return in XSLT

I want to implement carriage return within xslt. The problem is I have a varible: Step 1 = Value 1 breaktag Step 2 = Value 2 as a string and would like to appear as Step 1 = Value 1 Step 2 = Value 2 in the HTML form but I am getting the br tag on the page.Any good ways of implementing a line feed/carriage return in xsl would be apprec...

Handling web.config differences across multiple machines when using version control.

I'm sure everyone has to deal with these situations, we check in our solution to source control and each dev machine will have its own resources for debugging, building and testing.. The most common being: Web server (IIS) Database (SQL) The web server is easy to handle, each dev machine will have its own proj.user file to specify d...

XSLT 1.0: sorting between multiple documents

<xsl:for-each select="//filenames"> <xsl:variable name="current_filename" select="."/> <xsl:for-each select=" document(.)//someNode[not( . = document($current_filename/preceding-sibling::node())//someNode )] "> <xsl:value-of select="."/> </xsl:for-each> </xsl:for-each> In the above code (XSLT 1.0), I ...

javascript reference in xslt

I have a javascript file. how can i reference that file from within XSLT. ...

Using AXSLT Components in Spring MVC

I while ago I wrote a Java application that processes XML with XSLT using Xalan. Now I'm trying to move towards Spring. I've been having trouble accessing components. As far as I can tell my XML, XSLT and Java objects are correct, but Spring cannot seem to find and reference the components I want to access. ... <axslt:component prefix=...

Tokenizing and sorting with XSLT 1.0

I have a delimited string (delimited by spaces in my example below) that I need to tokenize, sort, and then join back together and I need to do all this using XSLT 1.0. How would I do that? I know I need to use xsl:sort somehow, but everything I’ve tried so far has given me some sort of error. For example, if I run the code at the bot...

Current node vs. Context node in XSLT/XPath?

In XSLT, what is the difference between the "current node" and the "context node"? You can find both terms used here: http://www.w3.org/TR/xslt When would you use one or the another? How do you refer to each? ...

Setting an XSLT variable as a javascript variable?

How would I grab an XSLT variable and use it to set a javascript variable? I'm working on a bit of AJAX and in order to make it work to the fullest I would like to be able to grab XSLT variables and use those to set the default values of some javascript variables that I'll then be manipulating with jQuery. ...