xslt

Using XSLT to process an HTML page and move a DIV from one place to another

I have a HTML page (fully valid) that is post-processed by XSLT. Let's say the relevant section of code looks like this: <div id="content"> ... </div> ... <div id="announcement"> ... </div> The XSLT needs to transform it to look like this: <div id="content"> <div id="announcement"> ... </div> ... </div> Any ideas? I'm stuck. Edit...

XSL to show highest number of copies in catalog.xml file

In this the catalog.xml file. I have two books who have the same inventory (i.e. 20). I want to write an XSL file that will display the highest number of copies of a book in a catalog. If there are two or more books of the same inventory then they have to be displayed. <catalog> <Book> <sku>12345</sku> <title>Beauty Secrets</t...

Can I build this XPath query dynamically in XSLT?

I have a document that looks something like <root> <element> <subelement1 /> <subelement2 /> </element> <element> <subelement2 /> <subelement1 /> </element> </root> In my XSLT sheet in the context of /element[2]/[someNode] I want to get a number that represents the distance of /element[1...

Replacing a Namespace with XSLT

Hi I want to work around a 'bug' in certain RSS-feeds, which use an incorrect namespace for the mediaRSS module. I tried to do it by manipulating the DOM programmatically, but using XSLT seems more flexible to me. Example: <media:thumbnail xmlns:media="http://search.yahoo.com/mrss" url="http://www.suedkurier.de/storage/pic/dpa/infoline...

Square Bullet in XSL-FO

I am attempting to create a list in XSL-FO using a square bracket. I have been able to get it working using the standard unicode bullet character (&#8226;) but I just can't seem to get it working for square brackets. I have tried using &#9632;, but that does not seem to work. It is important that i can get the square bullets working bec...

loading XML string into Xslt sheet

I am trying to load a xml document I created using PHP and DOM into a xslt sheet, but having no luck. $xml_string = $doc->saveXML(); //echo $xml_string; $xml = new DOMDocument; $xml->load($xml_string); $xsl = new DOMDocument; $xsl->load('musicInformation.xslt'); // Configure the transformer $proc = new XSLTProcessor; $proc->importS...

XML invoice specification

I am writing an application which produces invoices. Yes, it sucks. I was wondering it there was any agreed upon DTD for invoices? It seems like everybody has their own format. Perhaps there is a collection of XSLTs for tranforming a common standard into lesser known formats? ...

How can I transform XML to invalid XML using XSLT?

I need to transform a valid XML document to the OFX v1.0.2 format. This format is more or less XML, but it's technically invalid and therefore cannot be parsed as XML. I'm having trouble getting my Xml transformation working because the .Net XslCompiledTransform object insists on interpreting the output as an XML document (which is fai...

<xsl:value-of select="document(content)//title"/> returns empty node.

I'm trying to get title of simple html document to build sitemap. But always return empty value. I debug this and found out that document(content) returns document nodes. It looks like this. But I could not access document(content)/html or something like this. Please help! ...

validating whether a element exists and has some specific value in xsl

how to check the tag exists and the value is 'On' do something in xsl please correct me., <xsl:if test="$status and $status='On'"> //do something </xsl:if> can we skip checking whether the tag exists and direclty check for the value. <xsl:if test="$status='On'"> //do something </xsl:if> is it a correct practice., ...

xpath 2.0 query - how to test if the current element is the first element with this name in a xml document

I have the following xsl template: <xsl:template match="para"> <fo:block xsl:use-attribute-sets="paragraph.para"> <!-- if first para in document --> <!--<xsl:if test="//para[1] intersect .">--> <xsl:if test="//para[1] intersect ."> <xsl:attribute name="space-after">10pt</xsl:attribute> ...

XSLT: how to ignore unnecessary white space?

Hi, Given this example XML file: <doc> <tag> Hello ! </tag> <tag> My name is John </tag> </doc> And the following XSLT sheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:template match="/"> <xsl:for-each select="doc/tag"> <xsl:value-of select="."/> </...

XSLT Pagination

I have created a xslt document which formats an xml document, but I would like the results from the xslt sheet to be paginated. here is the orginal xlst document <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:output method="xml" version="1.0" encoding="UT...

AbstractMethodError on org.apache.xalan.processor.TransformerFactoryImpl

With the following code: private Document transformDoc(Source source) throws TransformerException, IOException { TransformerFactory factory = TransformerFactory.newInstance(); factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); factory.setFeature("http://xml.org/sax/features/validatio...

java.io.IOException: Server returned HTTP response code: 503 for URL: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd

In the following code: private Document transformDoc(Source source) throws TransformerException, IOException { TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(new StreamSource(xsltResource.getInputStream())); JDOMResult result = new JDOMResult(); ...

Looking for a library of XSLT to create SVG charts.

I'm looking for a library of XSLT to create SVG charts. I need pie charts, bar charts, line charts, all the usual suspects. I would hope for a reasonably simple DTD or Schema for the input files. Edit: I have the raw data for the charts and a mechanism to convert it into what ever XML is necessary for the XSLT library. ...

Please help me understand why my XSL Transform is not transforming

I'm trying to transform one XML format to another using XSL. Try as I might, I can't seem to get a result. I've hacked away at this for a while now and I've had no success. I'm not even getting any exceptions. I'm going to post the entire code and hopefully someone can help me work out what I've done wrong. I'm aware there are likel...

XSL How to copy identical + add copy with attributes changes

Hello I need to copy a node and its sub-nodes: first: one identical copy followed by a modified copy with some attributes values changed Here is the extract to change: <Configuration Name="Debug|Win32" OutputDirectory=".\Debug" IntermediateDirectory=".\Debug" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet=...

How to merge two XML files in classic ASP?

Hi! I'm using classic ASP in my project. I want to merge two XMLs together. How do I do this? Below is my sample code: XML 1 <CATALOG> <CD> <TITLE>1</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> <CD> <TITLE>2</TITLE> <ARTIST>Bon...

compact XSLT code to drop N number of tags if all are null.

This is my input xml: <root> <node1/> <node2/> <node3/> <node4/> <othertags/> </root> The output must be: <root> <othertags/> </root> if any of the 4 nodes isn't null then none of the tags must be dropped. example: <root> <node1/> <node2/> <node3/> <node4>sample_text</node4> <othertags/> </root> ...