xslt

Gotchas while bulk loading CouchDB

I've got ~15k rows in MSSQL 2005 that I want to migrate into CouchDB, where 1 row = 1 document. I have a CLR-UDF that writes n rows to an schema-bound XML file. I have an XSL transform that converts the schema-bound XML to JSON. With these existing tools I'm thinking I can go MSSQL to XML to JSON. If I batch n rows per JSON file, I...

Can i xslt if test = Unicode?

hi guys, i have this block of xslt if-else case and was wondering if there's a way for me to do straight comparison with unicode character? Something along the lines of the code shown below? Or does xslt have some built in function which i can use for this purpose? i.e. change the unicode into html entities and compare via that method?...

Dynamic Variables in XSLT

Hi, I'm passing in a bunch of key-value pairs as parameters to a XSL (date -> "20th January", author -> "Dominic Rodger", ...). These are referenced in some XML I'm parsing - the XML looks like this: <element datasource="date" /> At present, I can't work out how to get 20th January out of these except with a horrible <xsl:choose> st...

Performing XML Transformations in Flex

I'd like to be able to run an xml transformation using an xslt file in my AIR project. What's the best way to accomplish this? ...

Java/XSLT Problem: Cannot find a matching 1-argument

I get the following error: javax.servlet.ServletException: Cannot find a matching 1-argument function named {http://exslt.org/dynamic}evaluate() at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841) at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774) The top...

problem with XslCompiledTransform debugging in c#

i've tried and tried and tried but i cannot manage to step into the XslCompiledTransform without having to load the stylesheet from disk (by passing a URI into the XslCompiledTransform.Load() method). I am fully aware that you can only step into the XslCompiledTransform.Transform() method if you loaded the stylesheet from disk via URI (...

In XSLT how do I access elements from the outer loop from within nested loops?

I have nested xsl:for loops: <xsl:for-each select="/Root/A"> <xsl:for-each select="/Root/B"> <!-- Code --> </xsl:for> </xsl:for> From within the inner loop, how can I access attributes from the current node in the outer loop? I keep finding myself writing code like this: <xsl:for-each select="/Root/A"> <xsl:varia...

XSLT RegEx: replace HTML tags in CDATA

Hi I want to replace some HTML tags that I have in a CDATA element, but I struggle with getting the syntax in XSLT right. I am getting this error message: net.sf.saxon.trans.XPathException: Error at character 9 in regular expression "<img(\s+(?![^<>]*alt=["\'])[^<...": expected ()) (line 51) I guess it does not like the <> inside th...

XSL: Formatting numbers, excluding trailing zeroes

Hi, first time SO user :) I know that I can format a number like this: format-number($value, '###,###.00') But I would like to remove the dot and the zeroes if $value is zero. So, 37368 -> 37,368 2.666667 -> 2.66 Is this possible using just number formatting (doesn't seem like it) or do I have to do something along the lines of ...

How do I select the last N elements with XPath?

I support a web site which generates content XML that is then translated into web pages using XSLT. I have been asked to create a new stylesheet which will transform the output of the "archive" page into Atom for syndication. The problem I'm running into is that the archive page contains a rather large number of items — 142 and countin...

XSLT: Efficient mapping of two large lists

I've been tasked with writing some XSLT 2.0 to translate an XML document to another XML document. I'm relatively new to XSLT but I have learn alot during the days I've do this. During this time I have had to map simple values, i.e. 002 -> TH etc. This has been fine for small lists of less than 10 values, I used xsl:choose. However I need...

What is the Most Efficient Java-Based XSLT Processor?

I have a very large XML file which I need to transform into another XML file, and I would like to do this with XSLT. I am more interested in optimisation for memory, rather than optimisation for speed (though, speed would be good too!). Which Java-based XSLT processor would you recommmend for this task? Would you recommend any other w...

Version of XSLT in iPhone

I plan to use XML/XSLT in my iPhone application. What version of XSLT is currently supported on the iPhone? Can I use XSLT 2.0 or just 1.0 ? ...

Refering another element in XML

I'm trying to design an XML document structure for my application. I want to store a list of holes like following <Holes> <Hole id='1' dia='0.1' depth='2'/> <Hole id='2' dia='0.2' depth='1.67'/> <Hole id='3' dia='0.3' depth='0.44'/> </Holes> In another part of my document I want to refer to a hole by its id. e.g. <Drill useHoleWit...

XSLT with Xalan vs. STX with Joost

Where can I find performance metrics (memory/time) for a non-trivial example of using XSLT (with Xalan) compared to using STX (with Joost) ...

How to get the unparsed entity attribute's value from XSLT?

I have a problem with XSLT and unparsed entity in XML. Here is a fictional scenario. First I got an XML file named doc.xml: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE document [ <!ELEMENT document (employee)*> <!ELEMENT employee (lastname, firstname)> <!ELEMENT lastname (#PCDATA)> <!ELEMENT firstname (#PCDATA)> <!...

Converting from a Html encoded string to a 'normal' Url

I have a url in an xml documnent which is encoded <Link>http://www.sample.com/test.asp?goto=HOTWIZ%26eapid=857&lt;/Link&gt; I would like to convert that into a Url in the outputed Html. I can output a link ok but i need the %26 to be converted to an & I assume i could use some sort of replace functionality in XSLT but I imagine ther...

How to test for missing attribute in XSL?

What I have is following: <xsl:variable name="myvar" select=".//spss:category[((not @varName) or @varName=$colVarName) and @text=$series]/spss:cell/@text"/> What it should do is select the text of the spss:cell's text-Attribute as long as it is a child of a spss:category that has either a varName Attribute with a value equal to $col...

convert xhtml to wiki syntax using xslt

hi all, i would like to convert xhtml to dokuwiki syntax using xslt. now, one thing i can not seem to work my head around is how to handle nested lists. the dokuwiki syntax uses an asterisk (*) for a list item which is prepended by two white spaces per nesting level (c.f. wiki syntax). my question: in the following example, how can th...

HTML table with alternating row colors via XSL

What is the easiest way to alternate row colors in an HTML table (a.ka. striping). Most of my tables are created in XSL templates like the following, with the table, thead, etc.. defined in another template. <xsl:template match="typ:info"> <tr> <td> <xsl:value-of select="typ:dateAccessed" /> </td> <td> <xsl:val...