xslt

Simple XSLT Question: How can I add the closing "/" at the end of a single tag?

Hello, I'm teaching myself XSLT and am still trying to wrap my brain around the small details. I have a template in my XSL stylesheet that looks like this... <td><img src="{normalize-space(image)}"/></td> which produces XHTML that looks like this... <td><img src="somefile.jpg"></td> How do I change my XSL template to add a trailin...

Error received when attempting to load XSLT generated XHTML

Hello, I'm learning XSLT and Javascript and I'm trying to load some XSLT generated XHTML using the loadXML() function and I'm getting the following parsing error while using IE (might also be happening in FF to, not sure)... The server did not understand the request, or the request was invalid. Error processing resource 'http://www.w3.o...

XSL: Tracking elements that toggle

The following string gets encoded in my source XML using toggles, and I want it changed to nodes with formatting information. (This is XLIFF to WordprocessingML.) "Text, bold text, bold and italics text, bold text, plain text." Source XML: <text> Text <format id="1" type="bold" /> bold text, <format id="2" type="italics" /> bold ...

How to solve this error "The element type "head" must be terminated > by the matching end-tag "</head>"?

Why i'm getting this error Using org.apache.xerces.parsers.SAXParser Exception net.sf.saxon.trans.XPathException: org.xml.sax.SAXParseException: The element type "head" must be terminated by the matching end-tag "". org.xml.sax.SAXParseException: The element type "head" must be terminated by the matching end-tag ""...

How to edit XML with XSL ?

Hi everyone. I'm writing a dummy "MyAgenda" application in Java which has to allow maintenance of the XML file that stores the data. Say I have a XML file like: <myagenda> <contact> <name>Matthew Blake</name> <phone>12345678</phone> </contact> </myagenda> How can I add a new <contact> by using XSLT ? Thanks. ...

XPath, XSL: How to select all nodes, not just elements, when xsl:param is a node-set?

In an XSL recursion, this <xsl:with-param name="items" select="$items[position() > 1] would normally work to recurse with all nodes but the first. But it only works if the nodes are elements. If they are a mix of element and text nodes, the recursion fails, since, for example, $items[3] returns the third element node, not the third n...

Simplest way to transform XML to HTML with XSLT in C#?

XSLT newbie question: Please fill in the blank in the C# code fragment below: public static string TransformXMLToHTML(string inputXml, string xsltString) { // insert code here to apply the transform specified by xsltString to inputXml // and return the resultant HTML string. // You may assume that the xslt output type is HTML. } ...

To deal with Date Difference ..

Hi! I want to find out the difference between two Dates (in terms of minutes) appearing in two different elements as data in my XML file using XSLT. I can't use functions for this, as I am using visual studio 2008, in version 1.0 XSLT functions are not supported .. Ex- 11/12/2009 12:00 AM 12/01/2010 12:00 PM And also I have to see that...

Loading/Transforming XML with XSLT and CSS

Hi! Total newbie. Thanks in advance. Here goes: I'm trying to transform an XML document using an XSL stylesheet, and the XSL stylesheet links to a CSS file. When I open the XML file from my computer in a browser (Chrome), the data is displayed properly following the XSL and CSS files. I also have javascript math functions inside the X...

XSLT:How to deal with testing the value of an element ?

I have an xml file in which there is tag namely, <Gender/> It carries either 'M' or 'F' as data, now my work is to test the value and write <Gender_Tag>Male</Gender_Tag> or <Gender_Tag>Female</Gender_Tag> according to the values M or F respectively .. I tried this code .. It used to work in other circumstances.. <xsl:template match="roo...

How to group items by date range in XSLT?

I have a bunch of data that looks a little like this: <item> <colour>Red</colour> <date_created>2009-10-10 12:01:55</date_created> <date_sold>2009-10-20 22:32:12</date_sold> </item> <item> <colour>Blue</colour> <date_created>2009-11-01 13:21:00</date_created> <date_sold>2009-11-21 12:32:12</date_sold> </item> <item> <colou...

Does LINQ to XML replace XSLT?

Is there anything you can do in XSLT that can't be done in LINQ to XML? Is it still important to learn XSLT? When would you choose one over the other? ...

How to trigger XML (XSLT) transformation by using C# code ? How to pass parameters ("param"s) to XSLT?

This is the question I posted : Hi, I have an XSLT code which needs to take parameters (say one or two) from C# code .. (If you want to know, why I need to do this, then let me explain, I have to parse an input XML from certain external application, however I need to edit data of some tags taking the values of some other application whi...

XSL to HTML in .Net 1.1: How to include javascript which has '&&' without getting errors?

I am transforming xml to html using xslt in .Net 1.1. One part contains a javascript section where 2 vars are ANDed (&&). The transform throws an unknown entity error. What can I do? I have tried 'CDATA' and 'disable-output-escaping' but without success. If I write && then the output is also '&&'. Here is my code. (trimmed for clarity...

[XML+XSL+GOOGLE] website to be indexed in google?

Hi, I am not sure what or if I am doing something wrong at the website http://www.jode.com.br it uses XML and XSL transformation on the browser and after a week it still does not appear in google. it is normally using google-analytics, I can see the visits etc, but in google i got nothing I put meta tag in the xsl and in the xml j...

Put xml node's full path in attribute file and read the node's value from main xsl file in xsl fo

I have been using fop 0.95 to generate pdf files from xml data. I have three files involved in the process: test.xml, test.xsl and attributes.xsl. Naturally I have xml data in xml file. Here test.xml is the main xsl file which imports attribute sets from attributes.xsl file. For example, I have following entries in the attributes.xsl fil...

Render html in Swing application

I have a swing application that sends commands to server and receives result in XML format. I need to transform this into HTML via XSLT and then display result HTML on the panel. The problem is that the only Swing component which is able to display HTML - JEditorPane - takes either URL or javax.swing.text.StyledDocument as a source. Opt...

XPath expression to select all XML child nodes except a specific list?

Here's the sample data: <catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <customField1>Whatever</customField1> <customField2>Whatever</customField2> <customField3>Whatever</customField3> <company>Columbia</company> ...

Is there any way to call XSLT templates inline

How to call XSLT templates inline: So, Instead of : <xsl:call-template name="myTemplate" > <xsl:with-param name="param1" select="'val'" /> </xsl:call-template> I can use XSLT built-in function-call sytle, like this: <xls:value-of select="myTeplate(param1)" /> ...

XSLT Tranformation

Hi, I have the following xml and I'm writing a XSLT to transform it: <callop> <con>unit</con> <var>u</var> <var>v</var> </callop> The problem is that if <callop> is inside <is> then it should be a <nano> element and <con> becomes <Fun> but otherwise its an <Atom> and <con> becomes a <Rel>. How is this possible. Do I have to go and...