xslt

Efficient XSLT pipeline in Java (or redirecting Results to Sources)

I have a series of XSL 2.0 stylesheets that feed into each other, i.e. the output of stylesheet A feeds B feeds C. What is the most efficient way of doing this? The question rephrased is: how can one efficiently route the output of one transformation into another. Here's my first attempt: @Override public void transform(Source data, ...

XSLT: tricky transformation, need help!

hi! i have to build an XSLT stylesheet that transforms an xml like this: <message> <line/> <silence/> <dot/><line/><line/> <silence/> <dot/> <silence/> <line/><dot/><dot/><dot/> </message> into something like this: <complexMessage> <word code="-"/> <word code=".--"/> <word code="."/> <word code="-..."/> </compl...

Finding xmlns with xsl/xpath

I'm trying to obtain a list of information for the root element of an xml document using a transformation. The pieces I can't figure out are: How do I obtain the default namespace url? How can I obtain a list of every xmlns prefix and its related url? Here's my xml file: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="t...

How to train a team member to be the Xml Expert

Folks, I have got to work with a new team and design the required skills for each of them, I want to put a compressed training plan for one of them to be the Xml Expert in the team, as part of this I put him to read about XPath, XSLT from W3Schools, but what else he needs to know ? or is there a better source ? ...

How to apply a XSL template only on elements containing a child with a particular attribute value and element value ?

Hello, I have the following XML (partial) document : <export> <table name="CLIENT"> <row> <col name="CODE_CLIENT" type="System.String">1000010026</col> <col name="LIBELLE" type="System.String">Test|</col> <col name="PROSPECT" type="System.Decimal">1</col> </row> <row> <col name="CODE_CLIENT"...

problem with xslt and namespaces

I have a C# class that is serialized like this: <oadResults xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.tyr.org.uk/standards" > <Link>http://www.tyr.org.uk//290/Data.zip&lt;/Link&gt; <ID>3540</ID> </oadResults> And I have a XSLT file: <xsl:stylesheet ...

Can you insert blank lines in an already transformed PDF?

I have a situation where I need to increase the space between a table and the header on a PDF that has already been transformed from an XSL template. I need to insert an address in the newly created space. This part is easy enough and I can do that using a stamper and a new table. However, I am struggling to find a solution to move the...

Conditional XSLT transformation in PHP

I have a piece of XML data which I need to transform into WML. It's something like this: <root> <category name="music"/> <subcategory name="classic"/> <subcategory name="rock"/> <subcategory name="Techno"/> <node type="music" subtype="classic" name="beethoven"/> <node type="music" subtype="classic" name="chopin"/> <recor...

Inserting tags into soap header using XSLT

I am processing a soap response file and our requirement is add certain data captured during request to the response. I have this xml reponse here and like a add certain data to the header part of it using a XSLT file. Please advice. Actual reponse <soap:Envelope xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wsse...

Is there any way to transform cdata sections of an XML document with an XSL template?

Take this XML. Is there a way for me to transform the contents of the CDATA section with XSLT? ...

How to convert XML to a HTML table using XSL for-each

I am trying to convert some XML with XSL, to make the output look better and more readable for other users. I have some XML along the lines of: <G> <OE> <example1>Sample 1</example1> <example2>Sample 2</example2> <var name="name1"> <integer>1</integer> </var> </OE> </G> I want to get all the details from it a...

Keeping XSLT Code DRY with 'if' Tests and 'value-of' Selects.

In XSLT, what is the preferred way to keep code DRY when it comes to 'if's? At the moment I am doing this: <xsl:if test="select/some/long/path"> <element> <xsl:value-of select="select/some/long/path" /> </element> </xsl:if> I would prefer to only write "select/some/long/path" once. ...

XSLT to sum product of two attributes

Hi All I have the following XML source structure: <turnovers> <turnover repid="1" amount="500" rate="0.1"/> <turnover repid="5" amount="600" rate="0.5"/> <turnover repid="4" amount="400" rate="0.2"/> <turnover repid="1" amount="700" rate="0.05"/> <turnover repid="2" amount="100" rate="0.15"/> <turnover repid="1"...

How to select the second node using xsl:for-each in the listed xml content?

Hi, I have a list of figure names and width and height informations in separate xml file, I need to match the figure name in the source xml file and need to insert the width and height information as a attribute in the source xml file. here the source xml file.. <graphic name="sample.jpg" align="center"/> expected output xml file ...

Transforming XML mixed nodes with disable-output-escaping

Variations on this question have been posted, but I couldn't find any that address the base case. I thought it would be good to have a canonical answer to the simplest version of the problem. This question assumes xslt 1.0. I have an XML document that contains mixed nodes, e.g.: <paragraph> This is some text that is <bold>bold</b...

How to transform an sequence attribute to single element in the necessary place?

I have to make the attribute into single element. Please guide me. Here my input and requirement. Input: <book pagenum="01"> <title pagenum="01">Book title</title> <chapter pagenum="02"> <chaptertitle pagenum="02">CHAPTER TITLE</chaptertitle> <section pagenum="03"> <sectiontitle pagenum="03">SECTION TITLE</chaptertitle> <subsection pa...

How to use if statement in xsl to check if a path is valid?

Hello. What I am doing is reading in some xml and using xsl to output it in a table to make it more readable. So some sample xml: <example1> <sample name="aaa"> <help1>Help</help1> <help2>Me</help2> </sample> <sample name="bbb"> <noHelp1>No</noHelp1> <noHelp2>Help</noHelp2> </sample> </example1> So I have a ...

XSL/XML Retrieving attributes. Name/Value Pairs

I have a simple xml file that is a list of attributes (Name/Value pairs): <?xml version="1.0" encoding="ISO-8859-1"?> <Attrs> <Attr N="IsValid" V="true" /> <Attr N="ID" V="99099" /> </Attrs> I want to create an XSLT file that outputs the values but I cant seem to get it to return the Value for the attribute Here is my xslt: ...

XSL add a duration (exslt date)

I have an xsl where I want to display a default expiry date (now+1 month) I can display the current date with this (using: xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date") <xsl:variable name="currentdate" select="date:date()"/> <!-- add one month to $currentdate--> <xsl:value-of select="date:format-date(...

How To Tansform XML from one XSD to another XSD?

Hi there, Say I have the following XML <?xml version="1.0" encoding="utf-8"?> <Person> <FirstName>Bjorn</FirstName> <LastName>Ellis-Gowland</LastName> </Person> That is 'governed' by the following XSD (XML Schema) <?xml version="1.0" encoding="utf-8" ?> <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.or...