xslt

is it possible to sort an xml file using xsl

I have the following xml file <ScheduleProvider id="257" scheduleDate="2008-03-20T15:34:18Z" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="my.xsd"> <Content action="insert" duration="7200" id="2" title="movie-2"> <EpgDescription> <EpgElement key="Year">2002</EpgElement> ...

Working with XML...

I'm planning to create a news item which uses xml as it's backend and the Display should be like: Date: 08/Mar/2010 ------------------------------ Title     | News ------------------------------ News 4 | Some news News 3 | Some news News 2 | Some news News 1 | Some news ------------------------------ Date: 07/Mar/2010 ----------------...

Using XPath function fn:replace from XSLT

I'm trying to use XSLT to convert a simple XML schema to HTML and planned to use fn:replace to replace returns (\n) with <p>. However, I can't figure out how to use this function properly. A simplified version of the XSLT I'm using reads: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org...

Strange issue with jQuery and integration between xsl and javascript

Hallo all I got this piece of html code generated from a xsl file. <html id="lista_movimenti"> <head> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta content="text/css" http-equiv="Content-Style-Type"> <meta content="text/javascript" http...

Add a wrapper div to XSL XML

I have the following XSL translator that is is being used to generate some XHTML. The generated XHTML is then parsed as XML in C# so it can be injected into another XHTML document. The trouble is that the XHTML that is outputted from the XLS does not have a root XML node, just sibling nodes (< table > elements). I tried adding the div...

What is a striping error?

I'm trying to convert last.fm xml data into rdf using xslt and am getting this error: ERROR [http-8080-1] (RDFDefaultErrorHandler.java:40) - (line 3 column 24): {E202} Expecting XML start or end element(s). String data "Joseph Arthur" not allowed. Maybe a striping error. Can anyone explain to me what a striping error is, or in general w...

XSLT: can we use abs value ?

Hi guys, I would like to know if in XLST can we use the math:abs(...) ? I saw this somewhere but it does not work . I have something like: <tag> <xsl:value-of select="./product/blablaPath"/> </tag> I tried to do something like: <tag> <xsl:value-of select="math:abs(./product/blablaPath)"/> </tag> but does not work. Any ideas? ...

XSLT: How to pass a node value to a custom xsl:function ?

Hi all, I have a simple function that I want to pass the value of a node to. <xsl:function name="f:getdatetimetype" as="xs:string"> <xsl:param name="code" as="xs:int"/> <xsl:choose> <xsl:when test="$code = 137"> <xsl:text>DocumentMessageDateTime</xsl:text> </xsl:when> <xsl:otherwise> <xsl...

Merging two XML source documents with XSLT

XML file one could have 1000 - 6000 forms; XML file two could have one to 100 or more. I want to replace any identical form in file one with file two. If it exists in file 2 but not in file one I want to add it to file 1. After the files are merged I want to run it against my XSLT. I am using a 2.0 stylesheet and a Saxon parser. Fil...

Using grouping to pull together text and then test it

So in this grotty extruded typesetting product, I sometimes see links and email addresses that have been split apart. Example: <p>Here is some random text with an email address <Link>example</Link><Link>@example.com</Link> and here is more random text with a url <Link>http://www.&lt;/Link&gt;&lt;Link&gt;example.com&lt;/Link&gt; near ...

XSLT: not contains check

I need to create XSL that checks a "does not contain" condition. For example, my XML is like this: <Categories> <category> <blog>ABC</blog> <link>http://www.msdn.com&lt;/link&gt; </category> </Categories> I want to show every <blog> where <link> does not contain "msdn". I don't want to use equals because I just want to che...

How to GZIP a XSLT webpage

Hi, I am working on a webpage and I use XSLT as template engine. I only send XML and the XSLT file to the requester and let the receiver's browser render it in HTML. I would like to know how I could GZip the XSL Stylesheet and maybe the XML I'm sending to the requester. Thank you in advance. ...

Browser rendering XSLT vs PHP rendering XSLT

I use XML and XSLT in my current project and I would like to know if it's good to let the browser render the XML into HTML with stylesheet instead to use something like the PHP xsltprocessor. One main reason I use the Browser xslt processor is to allows API to access my XML data in a near future. So I want the transformation client-side...

Xslt and multi-line text (Sitecore)

I have a field in item (multi-line text) which i output in my xslt rendering. The problem is that carrigae return are not shown in my output - what do i need to do to make my xslt output show the carrigae returns? ...

Dynamic sort in XSLT?

I have some data which i output in a for-each loop in xslt. I have paging working on the list, but not the sort selector. The user should be able to sort on 2 values (created data, and a number field on each item). The default sort method is the create date, but when the user clicks "Sort by number" the list should instead order by a nu...

Generating pdf files from xml with fop and xsl with html formatted content

I'm using FOP to generate pdf files from xml sources. Some xml files have html in them like this: <element><value>&lt;strong&gt;lorem ipsum&lt;/strong&gt;</value></element> Is it possible with xsl to keep the html formatted content in the generated pdf? ...

Do something only on distinct XML nodes

Hello. I'm having hard times in triggering an xsl action only on distinct values. Here's an excerpt of my XML file: <?xml version="1.0" encoding="UTF-8" ?> <Doc Data="February 2010"> <Title>Title 1</Title> <Subject>Subject 1</Subject> </Doc> <Doc Data="January 2010"> <Title>Title 2</Title> <Subject>Subject 2</Subject> </Doc...

Finding unique nodes with xslt

I have an xml document that contains some "Item" elements with ids. I want to make a list of the unique Item ids. The Item elements are not in a list though - they can be at any depth within the xml document - for example: <Node> <Node> <Item id="1"/> <Item id="2"/> </Node> <Node> <Item id="1"/> <Node> <It...

XSLT & XPath: how to change XML file in the most effective way?

Hi guys, I'm a newbie in XSLT & XPath so please forgive me for this simple question. I have the following XML file: <?xml version="1.0"?> <Configuration serviceName="Just Service" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration"&gt; <Page name="Books"> <Instances count="5" /> ...

Visual Studio macro writes extra " mark

I thought i'd use a macro to speed up writing <xsl:choose> blocks. DTE.ActiveDocument.Selection.Text = "<xsl:choose>" DTE.ActiveDocument.Selection.NewLine() gives me (thanks to auto complete) <xsl:choose> </xsl:choose> however DTE.ActiveDocument.Selection.Text = "<xsl:choose>" DTE.ActiveDocument.Selection.NewLine() DTE.ActiveDocu...