xslt

How-to break a for-each loop in XSLT?

How-to break a for-each loop in XSLT? ...

Can I know how much of a XML document is processed by an XSL transformation?

I have rather large input XML files that must be converted to a given format with XSL. These XSL files have been hand-crafted, and we want to make sure that every non-empty text node in the original document is taken into account, i.e. either value-of'ed, copy-of'ed, or read and concatenated with something else. Is this even possible? I...

How can I change some existing Java XSLT code using Xalan to use Saxon and TinyTree

I have some existing Java code that does an XSLT transform programmatically - originally using Xalan. I have refactored it to be able to use another (externally configured) TransformerFactory. I have tried using the Saxon (v6.5.3 and v8.7) factory, but do not see any perfromance improvements - if anything Saxon is slower and uses more m...

meta and img tags, generated in an xlt are not being closed correctly

I'm trying to get the meta and img tags to close in the output from an xlt. I've looked into it, and it seems I need to select an "xml" method rather than "html", but this still doesn't seem to work. I've currently got: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL...

"dynamic" XSLT to feed webbrowser control?

I frequently use HTML output in applications, up to now I've used some simple routines to build an HTML string. I want to try something different now: I want to serialize the data to XML, and provide some XSLT templates to generate the HTML for the webbrowser control. I get that to work statically (slowly digging through writing XSL), b...

Microsoft.Reporting.* vs XML/XSLT

I would like to add reporting capabilities to a .NET application. My data source is just the data model of the application, i.e. a bunch of objects that may have been generated or loaded from anything (not necessarily from a database). The initial plan was to generate a report data XML file from these objects, and then use XSLT to trans...

Can an XSL template match in *ALL* modes?

Is there a way to write an XSL 1.0 template which is matching in all modes? Or do I have to write a separate template for every existing mode (including additional templates for modes being added in the future)? Here is what I have: <xsl:apply-templates mode="mode1" /> ... <xsl:apply-templates mode="mode2" /> ... <!-- Do not ...

How to generate XSLT from XML samples

I am looking for at tool for semi automatic XSLT generation. Given 2 XLM files, source: <elm>XXX</elm> and target: <exx>XXX</exx> The tool should make the XSLT file, which produces the target from the source. Looking at the content, it should identify changes in level, placement, element names etc. There is no general solution to ...

XSLT encoding problem, questionmarks in result

I'm trying to run an XSLT transformation, but characters like ëöï are replaced by a literal '?' in the output (I checked with an hex editor). The source file has the correct characters, and the stylesheet has: <xsl:output encoding="UTF-8" indent="yes" method="xml"/> What else am I missing? I'm using saxon as the transformer, if that ...

Is There An XSL Code Generator That Can Create XSLT By Example?

Given a source XML document and a sample of what it should look like after it is transformed, is there a code generator that could create an XSL transform to accomplish that. I am not expecting it to be perfect but, much like the code generators that can create XSD from sample XML, it would be a good starting point to then refine by han...

Why is CSharpOptParse UsageBuilder failing due to an XPathException only when used in an NUnit test?

What is the root cause of this issue? CSharpOptParse, XslTransform.Transform(...), or NUnit? What other equivalent library could I use instead, if this problem is unfixable, that is being actively supported? I'm using version 1.0.1 of CSharpOptParse which was last modified in Feb 2005. I've have the following class (simplified for this...

XSLT transformation datetime to date format

I'm trying to transform a datetime to a date format yyyy-MM-dd, because I'm using the xsd.exe tool the xs:date datatypes are automatically changed into a datetime datatype, because there is no type in the .NET Framework that matches the type xs:date completely. But I can't get it to work <articles> <article> <articlei...

XSLT 2.0, replace function: How to replace matched group with upper case?

Hello, If have a following element in my XSL file: <xsl:value-of select="replace(lower-case(@name), '_([a-z0-9])', '$1')" /> For example from 'get_polygene_lubricants' it makes 'getpolygenelubricants'. What I want to do is to replace the first letter after '_' with the uppercase variant of the letter. I googled, read documentation, ...

Format a date in XML via XSLT

When I use the XML serializer to serialize a DateTime, it is written in the following format: 2007-11-14T12:01:00 When passing this through an XSLT stylesheet to output HTML, how can I format this? In most cases I just need the date, and when I need the time I of course don't want the "funny T" in there. ...

dynamically concatenating xml files with ant and xslt

Question We have a large number of xml configuration files that we want merged into one master version at build time. Smaller config files are easier to maintain and one large file loads faster so I imagined this to be a popular build transformation process that I would find lots of good examples of on the net. I was able to find some...

Why xslt creats a new table but not uses the one of the template

I have a xml file like this <Root> ... <x></x> <node> ... <x></x> <y></y> </node> </Root> My xslt is <xsl:template match="/"> <!-- proceed the treatment of the statement before x--> <tr> <xsl:apply-templates match="Root/x"/> </tr> <tr> <xsl:apply-templates match="Root"/> </tr> </xsl:template> <xsl:template match=...

What are the DotNet 2.0 or 3.5, IE, XSL and XSL-FO capabilities?

Hi, I am total noob with XSL and XSL-FO and I am looking for some advice on the possibilities and limitations with DotNet 2.0 and 3.5 when using XSL for formatting XML Data For reporting purposes. Here is what I was looking to do. 1)Get data from a SQL 2005 DB based on some business rules 2) Output to xml from SQL directly or create...

How do I know my XSL is efficient and beautiful?

As a programmer, I am developing programs in procedural and OOP languages for many years now, and I guess I know beautiful and efficient code when I see it (or when I write it). Recently I started to work with XSLs, and while they deliver the results I expect, I have no idea whether they are nice and beautiful and efficient. (well, they...

XSLT Grouping

I have a simple XML with two levels (Header and Line) of tags such as: <?xml version="1.0"?> <Header> <line>Line 1</line> <line>Line 2</line> <line>Line 3</line> <line>Line 4</line> <line>Line 5</line> <line>Line 6</line> <line>Line 7</line> <line>Line 8</line> <line>Line 9</line> </Header> I need t...

What are the Differences between XSLT and the T4 Code Generation Methods?

I am just getting into the idea of code generation for repetitive coding tasks and have seen both of these approaches. I've seen the XSLT approach in an Apress book Code Generation in Microsoft .Net and have read about the T4 approach in relation to what's new in the MVC framework. What kind of projects is each method better suited for?...