xslt

Using XSLT, How Do You Insert XML Into an existing XML node

I'm not even sure if it's possible but say I have some XML: <source> <list> <element id="1"/> </list> </source> And I would like to insert into list: <element id="2"/> Can I write an XSLT to do this? ...

How do I convert a .docx to html using asp.net?

Word 2007 saves its documents in .docx format which is really a zip file with a bunch of stuff in it including an xml file with the document. I want to be able to take a .docx file and drop it into a folder in my asp.net web app and have the code open the .docx file and render the (xml part of the) document as a web page. I've been sea...

How to escape XML content with XSL to safely output it as JSON?

How to escape XML content with XSL to safely output it as JSON? ...

How can I make an exact copy of a xml node's children with XSLT?

My problem is that my XML document contains snippets of XHTML within it and while passing it through an XSLT I would like it to render those snippets without mangling them. I've tried wrapping the snippet in a CDATA but it doesn't work since less than and greater than are translated to < and > as opposed to being echoed directly. What'...

xslt and xpath: match conditionally upon current node value

given the following xml: <current> <login_name>jd</login_name> </current> <people> <person> <first>John</first> <last>Doe</last> <login_name>jd</login_name> </preson> <person> <first>Pierre</first> <last>Spring</last> <login_name>ps</login_name> </preson> </people> how can i get "John Doe" from within...

Is it possible to pass a parameter to XSLT through a URL when using a browser to transform XML?

When using a browser to transform XML (Google Chrome or IE7) is it possible to pass a parameter to the XSLT stylesheet through the URL? example: data.xml <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="sample.xsl"?> <root> <document type="resume"> <author>John Doe</author> </document> ...

JavaScript in client-side XSL processing?

Is it possible to have XML-embedded JavaScript executed to assist in client-side (browser-based) XSL transformations? How is it done and how official is it? Microsoft's XML DOM objects allow this on the server-side (i.e. in ASP/ASP.NET). Clarification: I do not mean HTML DOM scripting performed after the document is transformed, nor d...

XSLT: Cannot get xslt to output an (&) even after escaping the character.

I am trying to create a query string of variable assignments separated by the & symbol. (ex: "var1=x&var2=y&...") I plan to pass this string into an embedded flash file. I am having trouble getting an & symbol to show up in xslt. If I just type "&" with no tags around it there is a problem rendering the xslt document. If I type "&amp;" w...

Merge multiple xslt stylesheets

I have a xslt stylesheet with multiple xsl:imports and I want to merge them all into the one xslt file. It is a limitation of the system we are using where it passes around the xsl stylesheet as a string object stored in memory. This is transmitted to remote machine where it performs the transformation. Since it is not being loaded from...

XSLT processing in/from ruby

Can anyone recommend an efficient method to execute XSLT transforms of XML data within a Ruby application? The XSL gem (REXSL) is not available yet, and while I have seen a project or two that implement it, I'm wary of using them so early on. A friend had recommended a shell out call to Perl, but I'm worried about resources. This is fo...

Sharepoint: Best way to display lists of non-Sharepoint content with "compatible" UI?

I've built a web part for Sharepoint that retrieves data from an external service. I'd like to display the items in a way that's UI-compatible with Sharepoint (fits in with its surroundings.) I'm aware of the "DataFormWebPart" but was unable to get one working properly. It requires a valid DataSource and I was unable to build one from...

How do I get an attribute value when using XSLT with unknown namespace?

I am receiving a 3rd party feed of which I cannot be certain of the namespace so I am currently having to use the local-name() function in my XLST to get the element values. However I need to get an attribute from one such element and I don't know how to do this when the namespaces are unknown (hence need for local-name() function). N.B...

Why has XSLT never seen the popularity of many other languages that came out during the internet boom?

The use of XSLT (XML Stylesheet Language Transform) has never seen the same popularity of many of the other languages that came out during the internet boom. While it is in use, and in some cases by large successful companies (i.e. Blizzard Entertainment), it has never seemed to reach mainstream. Why do you think this is? ...

Is XSLT worth it?

A while ago, I started on a project where I designed a html-esque XML schema so that authors could write their content (educational course material) in a simplified format which would then be transformed into HTML via XSLT. I played around (struggled) with it for a while and got it to a very basic level but then was too annoyed by the li...

How do I format text in between xsl:text tags?

I have an xslt sheet with some text similar to below: <xsl:text>I am some text, and I want to be bold<xsl:text> I would like some text to be bold, but this doesn't work. <xsl:text>I am some text, and I want to be <strong>bold<strong> </xsl:text> The deprecated b tag doesn't work either. How do I format text within ...

We're manually mapping our internal data elements to external vendors' xml schema. there's gotta be a better way...

I'm considering Altova MapForce (or something similar) to produce either XSLT and/or a Java or C# class to do the translation. Today, we pull data right out of the database and manually build an XML string that we post to a webservice. Should it be db -> (internal)XML -> XSLT -> (External)XML? What do you folks do out there in the wide...

XSLT performance: call-template vs apply-template

in XSLT processing, is there a performance difference between apply-template and call-template? In my stylesheets there are many instances where I can use either, which is the best choice? ...

Unpivot xml doc based on attributes using XSLT

I have a simple xml document that looks like the following snippet. I need to write a XSLT transform that basically 'unpivots' this document based on some of the attributes. <?xml version="1.0" encoding="utf-8" ?> <root xmlns:z="foo"> <z:row A="1" X="2" Y="n1" Z="500"/> <z:row A="2" X="5" Y="n2" Z="1500"/> </root> This is what...

How do I preserve line feeds, tabs, and spaces in data while still wrapping text?

I had data in XML that had line feeds, spaces, and tabs that I wanted to preserve in the output HTML (so I couldn't use <p>) but I also wanted the lines to wrap when the side of the screen was reached (so I couldn't use <pre>). ...

Using DateAdd in umbraco xslt to display next year's date

I'm trying to display the date for a year from now in an xslt file using umbraco like so: <xsl:variable name="now" select="umbraco.library:CurrentDate()"/> <xsl:value-of select="umbraco.library:DateAdd($now, 'year', 1)"/> The value-of tag outputs today's date. How can I get the DateAdd to add a year to the current date? ...