xslt

How to convert relative links in atom feed to absolute with XSL?

I'm pulling an Atom feed from Confluence. Some of the links and images are relative to the domain (/), so when I consume the feed on a different website the images and links are broken. Is it possible to convert all app relative links to absolute with xslt? Is there a better approach? Here's a sample ...

XSLT string replace

I don't really know XSL but I need to fix this code, I have reduced it to make it simpler. I am getting this error Invalid XSLT/XPath function on this line <xsl:variable name="text" select="replace($text,'a','b')"/> This is the XSL <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XS...

XSLT modify node before applying template

I have an XSL code that processes some nodes and if some condition is true, before doing apply-template select="." i need to modify current node(add and attribute). How can i add an attribute to the node before calling apply-template select=".", or it is not possible at all ? ...

Evaluate a string-expression in XSL

Is there any way to evaluate a string expression in XSL? example: <myItem id="1"> <validator expression="$someVariable = '3'" /> </myItem> ... <xsl:variable name="someVariable" select="3" /> <xsl:if test="@expression"> ... I realize this syntax does not work the way I want it to, but is there any way to store the test expression...

Reusing XSL template to be invoked with different relative XPaths

Here is my contrived example that illustrates what I am attempting to accomplish. I have an input XML file that I wish to flatten for further processing. Input file: <BICYCLES> <BICYCLE> <COLOR>BLUE</COLOR> <WHEELS> <WHEEL> <WHEEL_TYPE>FRONT</WHEEL_TYPE> <FLAT>NO</FLAT> ...

using urn:helper in xsl

Hi I'm new to xslt. I tried using urn:helper in the stylesheet tag. But it throws the following error. "Cannot find the script or external object that implements prefix 'urn:Helper'". Below is the snippet used in my code. xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:myObj="urn:Helper" xmlns:t="ht...

Using XSL to keep a running total

I have the following XML: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="disp.xsl"?> <root> <node type="a"> <value>4</value> </node> <node type="b"> <value>2</value> </node> <node type="a"> <value>3</value> </node> <node type="b"> <value>1</value> </node> </root I want to produce a repor...

Changing navigation between nodes (XSLT)

Hi everyone.. I have a menu with three industries and an "active" option: <ul> <li id="p_active"><a href="active.xml">Active</a></li> <li id="p_education"><a href="education.xml">Education</a></li> <li id="p_energy"><a href="energy.xml">Energy</a></li> <li id="p_services"><a href="services.xml">Services</a> </li> </ul> There are a nu...

XSLT problem concerning call-template & with-param

I'm banging my head against the wall trying to figure out why this won't work: <xsl:call-template name="test-template"> <xsl:with-param name="item" select="WTF" /> </xsl:call-template> <xsl:template name="test-template"> <xsl:param name="item" /> -~<xsl:value-of select="$item" />~- </xsl:template> Output is: -~~- when wha...

Dynamic path in document function()

The XML file name is specific but I need to build a dynamic path. I have tried using a variable to build the path but it didn't work: <xsl:variable name="path"> ...conditional code </xsl:variable> <xsl:value-of select="document('myXML.xml')/worksheets/$path"/> 2.0 solutions ok. ...

how can i get the same name child text using xslt?

source: <article> <title>title1</title> <description>des1</description> <child> <children> <subarticle> <title>subtitle11</title> <description>subdes11</description> </subarticle> </children> <children> <subarticle> <title>subtitle12</title> <description>subdes12</description> </subarticle> ...

Regular Expressions in match attribute

Hello. I just want to know if it's possible to use regular expressions in the match attribute of the template element. For example , suppose i have the follow xml document: <greeting> <aaa>Hello</aaa> <bbb>Good</bbb> <ccc>Excellent</ccc> <dddline>Line</dddline> </greeting> Now the xslt to transform the above document:...

Use XSLT to enumerate Nodes with the same name

Hi, I have many many XML files that often contain nodes mutiple times (each time with different data). Example: <?xml version="1.0" encoding="UTF-8"?> <SomeName> <Node> DataA </Node> <Node> DataB </Node> <Node> DataC </Node> <AnotherNode> DataD </A...

Counting nodes with certain attribute values in XSLT

Suppose I have some XML like this: <section name="SampleSection"> <item name="ScoredItem1"> <attributes> <scored data_type="boolean" value="true"/> </attributes> </item> <item name="UnscoredItem1"> <attributes> <scored data_type="boolean" val...

xslt help - remove empty tags and replaces * with empty tags

Hi, I am having a problem while doing some XSLT pre-processing in my java program. We get an asterisk (*) from a mainframe program when it wants to blank out a value, which my java process has to treat like a blank or empty tag. So we apply an xslt to the input before my jaxb process. We are applying this xslt : <xsl:stylesheet vers...

Webservice to apply XSLT to response before sending?

Hello, I have a basic asp.net webservice that returns a simple response. To make it ucore compliant I need to apply an XSLT. Is there a way to apply an XSLT to my response? I'm aware the receiver can apply it on their end, but in this scenario I need to apply it on my end. Thanks! ...

Is there a way to XSLT to echo out the XML powering it?

Basically I am using some XSLT to transform XML, is there a way for the XSLT to spit out the XML that is feeding it? Something like: <xsl:echo-xml /> ...

Determining which disjunct in an xsl:template match matched

Suppose I have XML like this: <xsl:template match="assessment | section "> . . . </xsl:template> I do this because I mostly want to treat assessment and section nodes the same. However, I do want to treat them a little differently. How can I tell whether a match was for assessment or for sectio...

Displaying line breaks in XML using ASP.NET with XSLT

Hello all, I have a problem with my XML that I am trying to display on my ASP.NET page that I could do with some help with. What I would like to do is display it on a multi-line so I have an XML file that looks like this: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="News.xslt" ?> <newslist> <news> <date>20th June ...

XSL 1.0 Transformation to merge Nodes

Is it possble to do the transformation below using XSL 1.0. If yes can please post some sample code which can get me started in the right direction. <Region> <RecType1><Amt> 100 </Amt></RecType1><RecType2><Name>XXX</Name></RecType2><RecType1><Amt> 200 </Amt></RecType1><RecType2><Name>YYY</Name></RecType2><RecType1><Amt> 300 </Amt></Rec...