Inserting a line break in a PDF generated from XSL FO using

You could also replace <br/> with &#xA; and add a linefeed-treatment=”preserve” attribute to your <fo:block>. Something like: <fo:block linefeed-treatment=”preserve”>This is an example Description.&#xA;List item 1&#xA;List item 2&#xA;List item 3&#xA;List item 4</fo:block> Edit Some users may need to use \n instead of &#xA; depending on how they are creating the XML. See Retain the &#xA; during … Read more

JSON to JSON transformer

Try JOLT. It is a JSON to JSON transformation library written in Java. It was created on a project that was transforming lot of JSON from an ElasticSearch “backend” to a frontend api. For the JSON transform you have listed in your problem, the Jolt “shift” spec would be : // Jolt “shift” spec { … Read more

use xsl to output plain text

You can define a template to match on script/command and eliminate the xsl:for-each concat() can be used to shorten the expression and save you from explicitly inserting so many <xsl:text> and <xsl:value-of> elements. The use of an entity reference &#xA; for the carriage return, rather than relying on preserving the line-break between your <xsl:text> element … Read more

How to set Saxon as the Xslt processor in Java?

There are multiple ways to do this (in order of lookup precedence): Direct Instantiation Explicitly instantiate the Saxon factory (with a nod to Michael’s comment above): TransformerFactory fact = new net.sf.saxon.TransformerFactoryImpl() This approach means that your code is locked into using Saxon at compile time. This can be seen as an advantage (no risk of … Read more

Converting XML to plain text – how should I ignore/handle whitespace in the XSLT?

There are three reasons for getting unwanted whitespace in the result of an XSLT transformation: whitespace that comes from between nodes in the source document whitespace that comes from within nodes in the source document whitespace that comes from the stylesheet I’m going to talk about all three because it can be hard to tell … Read more

How to get a JSON response for ItemLookup/Search using Amazon Product Advertising API

Try either of these :: Amazon JSON API – This is a ruby webservice to pass through requests and translate the responses to JSON. Try any of these Javascript functions to convert the XML you already have into JSON : http://goessner.net/download/prj/jsonxml/ http://davidwalsh.name/convert-xml-json http://www.fyneworks.com/jquery/xml-to-json/ http://www.thomasfrank.se/xml_to_json.html I’ve tried thomasfrank myself. Its easy and works well 🙂

How to add multiple test conditions in ‘test’ attribute expression of tag

<xsl:if test=”$var=”ab” | $var=”bc” | $var=”ca” “> This is wrong — you are using the XPath union operator | on boolean values. Solution: use the XPath or operator: <xsl:if test=”$var=”ab” or $var=”bc” or $var=”ca” “> The above XPath expression (the value of the test attribute) can be optimized, so that only one comparison is made … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)