xslt

XSLT: Getting the latest date

I have a structure like this: <Info ID="1"> ... <Date>2009-04-21</Date> </Info> <Info ID="2"> ... <Date>2009-04-22</Date> </Info> <Info ID="3"> ... <Date>2009-04-20</Date> </Info> I want to get the latest date using XSLT (in this example - 2009-04-22). ...

Is there an online tester for xPath selectors?

I know there are some online regex evaluators.. very useful, matching in real time. They are like web applications of RegexBuddy. I was wondering if there is a similar thing for xPath selectors? I am just learning them and it would be valuable to me. Is there an online tester that allows you to input XML and then an xPath selector and ...

transforming xml embedded in html

Hi, suppose I have xml inside an html document like <html> <body> <xml> <foo> <bar /> <baz /> </foo> </xml> </body> </html> What is the best way to apply xslt to the xml node? ...

when xsl:foreach is really useful?

Could anybody give an example when xsl:foreach is really useful? I just made a project and concluded that everywhere I could replace it with appropriate <xsl:apply-templates />. <xsl:if> and <xsl:when/> sometimes make code shorter and i cannot effectively replace it with <apply-templates/> in functional style. Is <xsl:foreach> conside...

Problem with XSLT and Namespaces

Hi, I am new to XSLT, so this question may have been answered other times. I've searched but I did not found anything :( I need to parse an XML like this <ns1:tagName1> <ns2:tagName2> This is the content </ns2:tagName2> </ns1:tagName1> And I using this XSL for that <xsl:template match="ns1:tagName1"> <r...

C# script in XSLT: "msxsl:script cannot be empty" error

Hello! I have an XSLT with a C# script in it: <msxsl:script language="C#" implements-prefix="user"> <msxsl:using namespace="System.Xml"/> <msxsl:using namespace="System.Xml.XPath"/> <![CDATA[ public string GetMenuPath(XPathNodeIterator node) { XPathNavigator dataSourceNode = node.Current; return dataSource...

Elegant examples of xslt?

After a long learning loop via XAML, I've returned to HTML and javascript, and realised that the concept of declarative code - in terms of rules for transformation - is an incredibly powerful concept. Despite its surfeit of syntax, XSLT processing of XML is the keystone of declarative transformation programming. I have, however, always ...

XSLT variables

I am trying to learn XSLT. I am simply getting crazy. Variables should be declared within xsl:variables entity and instantiated with their names having the $ symbol just before them (like perl variables), right? Why on earth this code: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:templa...

xpath selection on elements with namespaces

Here's a trivial but valid Docbook article: <?xml version="1.0" encoding="utf-8"?> <article xmlns="http://docbook.org/ns/docbook" version="5.0"> <title>I Am Title</title> <para>I am content.</para> </article> Here's a stylesheet that selects title if I remove the xmlns attribute above, and not if I leave it in: <?xml version="1.0" en...

How can I transform an element attribute to an element name in XSLT?

I'd link to transform XML with attributes like the 'name' attribute in the following: <books> <book name="TheBumperBookOfXMLProgramming"/> <book name="XsltForDummies"/> </books> into elements called what was in the name attribute: <books> <TheBumperBookOfXMLProgramming/> <XsltForDummies/> </books> using XSLT. Any ideas? ...

Processing XML into MySQL in good form

I need to process XML documents of varying formats into records in a MySQL database on a daily basis. The data I need from each XML document is interspersed with a good deal of data I don't need, and each document's node names are different. For example: source #1: <object id="1"> <title>URL 1</title> <url>http://www.one.com&...

Rendering HTML Tags from within CDATA tag in XSL

I have a CDATA tag within my XML code which contains some hyperlinks. <smartText><![CDATA[ Among individual stocks, the top percentage gainers in the S.&P. 500 are <a href ='http://investing.domain.com/research/stocks/snapshot /snapshot.asp?ric=LNC'>Lincoln National Corp</a> and <a href ='http://investing.domain.com/research/stocks/s...

XSLT: Merge a set of tree hierarchies

I have an XML document based what Excel produces when saving as "XML Spreadsheet 2003 (*.xml)". The spreadsheet itself contains a header section with a hierarchy of labels: | A B C D E F G H I -+----------------------------------------------------- 1| a1 a2 2| a11 ...

xslt using c# function and used for a hyperlink

I have some xslt that uses a c# function to get a string, im calling it like this: <xsl:value-of select="myClass:GetContent('key')" /> it works fine. but i now need to use it part of a url. <a href="{concat('/',select='myClass:GetContent('key')','/mysite.com')}"> i cant get it working... any ideas what to do? thanks ...

Hyperlinks within XSLT Templates

I am trying to create hyperlinks using XML information and XSLT templates. Here is the XML source. <smartText> Among individual stocks, the top percentage gainers in the S. and P. 500 are <smartTextLink smartTextRic="http://investing.domain.com/research/stocks/snapshot /snapshot.asp?ric=HBAN.O">Huntington Bancshares Inc</smartTextLink...

XML for Web Service: inline attachment

I have to invoke a web service with a single parameter, a String in XML format. I'm building this via an XSLT transformation. So far so good. The problem is with this XSD fragment: <xs:complexType name="Document"> <xs:sequence> <xs:element name="title" type="xs:string" minOccurs="1"/> <xs:element name="content" typ...

Customizing pdf output of dblatex

I am writing a report using Docbook and i want to customize the way that dblatex converts Docbook to Pdf. This page is supposed to document this issue but it really doesn't help me. How can i learn how the latex style package works? ...

Printing Out The Value Of An XSL Variable

Hi all, Can someone please tell me how to print out a variable in my XSL transform? Seems like an easy enough thing to do but I just can't seem to do it. Here's the code I have: <?xml version='1.0' encoding='UTF-8' ?> <xsl:stylesheet version="1.0" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:xsl="http://www.w3.org/1999...

Retrieving data from xml file created by xsl

Not sure if the title makes any sense, but I need to read an XML document and retrieve the data created by an XSL XPath query. The XML is located here and the XSL here. If that's not possible, I'm assuming that I'll have to write the XPath query manually. So my question is, since XSL already generates the total, any way to parse it out...

Alternative to NSXMLDocument on the iPhone for XSLT purposes...

I know it's been asked before (like here), but is there way to natively use XSLT on the iPhone? If not, and I need to use libxslt, is there any documentation/tutorial of how to use it on the iPhone? EDIT: I've decided to use libxslt. What files are necessary to include? I haven't found any tutorials of examples of use on the iPhone, and...