To transform the XML file while exporting from SSRS - reporting-services

I have a requirement to transform the XML format of the SSRS report while exporting. I tried with some XSLT to implement this, but not getting desried output.
Default XML format of my report is
<?xml version="1.0" encoding="utf-8"?>
<Report xsi:schemaLocation="Test http://reportserver? %2FTest&rs%3AFormat=XML&rc%3ASchema=True" Name="Test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="Test">
<Tablix1>
<Details_Collection>
<Details Country="India" Sales="1000.0000" />
</Details_Collection>
</Tablix1>
</Report>
Output Needed (Report Tag is removed and the look and feel should be changed as below):
<?xml version="1.0" encoding="utf-8"?>
<Tablix1>
<Details_Collection>
<Details>
< Country>"India"</COuntry>
<Sales>1000.0000</Sales>
</Details>
</Details_Collection>
</Tablix1>
Br,
Shamsuddeen

I found second part of transformation:
<Details Country="India" Sales="1000.0000" />
->
< Country>"India"</Country>
<Sales>1000.0000</Sales>
For this purpose you should use TexBox Properties.
Press on your Data Filed in Designer mode
Find DataElementOutput - Set Output
Find DataElementStyle -Set Element
After that - you'll receive that you wanted.
But first part of transformation I could'n do.
I mean - remove <Report xsi:schemaLocation="Test http://reportserver?......>
If you already have a solution - advice.
BR,
Timur

Related

Replace LaTeX formulas in HTML markup with IMG tags linked to generated SVG images

I have an XML file witch in some nodes contains HTML markup. I want to be able to use LaTeX formulas there. I'm trying to find a way to generate another XML file with those formulas replaced with <img src="..."> tags, and produce corresponding svg images. Is there a tool for that, or is the task to specific and I need to write it myself? I was hoping that there is something that I could tweak a little to get it to work like that.
Example is below:
Input file:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<snippet>
In mathematics, <b>Euler's identity</b> is the equality $e^{i\pi}+1=0$.
</snippet>
<snippet>
Albert Einstein's famous formula:
$$E=mc^2$$
</snippet>
</root>
Output files:
f1.svg
f2.svg
<?xml version="1.0" encoding="UTF-8"?>
<root>
<snippet>
In mathematics, <b>Euler's identity</b> is the equality <img src="f1.svg" />.
</snippet>
<snippet>
Albert Einstein's famous formula:
<img src="f2.svg" />
</snippet>
</root>
I was looking into mathjax-node and mathjax-node-cli and found the tool tex2svg witch takes a TeX string and produces a single image. Seems like a part of what I need, but there's still a lot to do.

XSL stylesheet keeps Firefox from recognising DTD-defined ids

I want a client-side XSL-transformed document with elements targettable (jumpable to) by #foo (URL fragments). Problem is, as soon as I attach the simplest XSL stylesheet, Firefox stops scrolling to the elements. Here's simple code:
test.xml:
<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet type='text/xsl' href='test.xsl'?>
<!DOCTYPE foo [<!ATTLIST bar id ID #REQUIRED>]>
<foo xmlns:html='http://www.w3.org/1999/xhtml' xml:lang='en-GB'>
<html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/>
<bar id='baz'>Baf.</bar>
</foo>
test.xsl:
<xsl:stylesheet version='1.0' xmlns:html='http://www.w3.org/1999/xhtml' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match='/'>
<xsl:copy-of select='.'/>
</xsl:template>
</xsl:stylesheet>
As soon as I uncomment the stylesheet line, /test.xml#baz does nothing. As though the transformation somehow loses some data about elements' identification.
Any ideas? Thanks.
Well the XSLT/XPath data model does not include any DTD and thus your result tree that XSLT creates is a copy of the input without the DTD, thus there is no definition of any ID attributes in the result tree and Firefox has no way of establishing to which element with which attribute #some-id refers.
Usually if you use client-side XSLT in the browser the target format is (X)HTML or SVG or a mix of both where id attributes are known by the browser implementation without needing a DTD. If you want to transform to a result format unknown to the browser then I don't think there is a way to use DTDs for the result tree in Firefox/Mozilla. And I am not sure whether they ever implemented xml:id support so that you could use that instead of defining your own ID attributes.
Martin Honnen's mention of XHTML resulted in experimentation during which I found out that setting the target element's namespace to XHTML's, xmlns='http://www.w3.org/1999/xhtml', does the trick. It doesn't seem very clean, but it doesn't seem as grave as, for instance, setting the whole doctype to XHTML's. So text.xml is now:
<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet type='text/xsl' href='test.xsl'?>
<foo xmlns:html='http://www.w3.org/1999/xhtml' xml:lang='en-GB'>
<html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/><html:br/>
<html:bar id='baz'>Baf.</html:bar>
</foo>
Also relevant might be http://xmlplease.com/xhtmlxhtml I found.
Thanks, all.

CSS animations stop working when XML file is transformed in XSLT

I have a page, with multiple animations on it. If I save it as an html file and run it in a browser, it works as it should, but has no information as I have no imported the xml document. When I add in my xml, by using xslt transformation, and save it as xsl not html, the animations will no longer run, and I'm lost as to why this is happening.
I use
<?xml-stylesheet type="text/xsl" href="blog.xsl" ?>
to connect my xml file with the xslt, and then in xml use
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
</html>
Any help as to why it's not working as xslt but is as html would be hugely appreciated.
Thanks.
Edit:
<?xml version='1.0' encoding="UTF-8"?>
<!DOCTYPE blog SYSTEM "blog.dtd">
<?xml-stylesheet type="text/xsl" href="blog.xsl"?>
<blog>
<blogPost>
<postTitle> First Test Post </postTitle>
<postText> This is a test post </postText>
<postImage></postImage>
<postQuote> Happiness can be found even in the darkest of times if one only remembers to turn on the light </postQuote>
<postLink> www.pandora.net </postLink>
<postAudio></postAudio>
<postVideo></postVideo>
<postChat></postChat>
<postDate> 12th June </postDate>
<postTags> FirstPost New </postTags>
</blogPost>
<blogPost>
<postTitle> Post Two </postTitle>
<postText> This is a another test post </postText>
<postImage></postImage>
<postQuote> Never let the fear of striking out keep you from
playing the game</postQuote>
<postLink> www.surfdome.com </postLink>
<postAudio></postAudio>
<postVideo></postVideo>
<postChat></postChat>
<postDate> 12th June </postDate>
<postTags> FirstPost New </postTags>
</blogPost>
</blog>

Docbook - suppressing TOC

I am converting a docbook to an html using 1.77 xsl transformation. But when it is transformed it automatically generates a Table of Contents. How do you change this behavior?
I have found this: Disable table of contents for documents
So I am guessing that html xsl transform would be the presentation system?
Elaborate DocBook formatting is meant to be customized using an xsl stylesheet.
See Also
Writing a DocBOok Customization Layer for Formatting
Customizing Table Of Contents Using XSL
customize_formatting.xsl: Example DocBook XSL Customization Layer
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0"> <!-- change this to 2.0 if your tools support it -->
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
<!--uncomment this to suppress toc when using XSL 1.0 or 2.0
<xsl:param name="generate.toc">article</xsl:param>
<xsl:param name="generate.toc">book</xsl:param>
-->
<!--uncomment this to suppress toc when using XSL 2.0
<xsl:param name="generate.toc">
article nop
book nop
</xsl:param>
-->
</xsl:stylesheet>
How to Use customize_formatting.xsl
Point your tools to use customize_formatting.xsl instead of the off-the-shelf docbook.xsl. Then, put all your formatting customizations in the body of the <xsl:stylesheet> section.
For TOC suppression, you can just uncomment the appropriate line.
There is a quirk with some (or maybe all) XSL 1.0 tools that seem to prevent them from handling the whitespace-separated pairs used in the body of <xsl:param name="generate.toc">. I have had success suppressing TOC by just using the single word article or book instead of the proper whitespace separated pairs.
When transforming, you can use the Transformer#setParameter(String, Object) method to specify no TOC generation like this:
transformer.setParameter("generate.toc", "nop");

Problem adding namespaces to MSXML (using setProperty('SelectionNamespaces', ...))

A while back, I asked a question regarding the usage of namespaces in MSXML. At first, I circumvented the whole thing with the XPath *[local-name()]-hack (see my previous post), but having a crisis of conscience I decided to do things the right way. (Doh!)
Consider the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<Root xsi:schemaLocation="http://www.foo.bar mySchema.xsd" xmlns="http://www.foo.bar" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MyElement>
</MyElement>
</Root>
When I try to add these namespaces using IXMLDOMDocument3.setProperty('SelectionNamespaces', NSString);, I get the following error: "SelectionNamespaces property value is invalid. Only well-formed xmlns attributes are allowed.". When removing the namespace xsi:schemaLocation="http://www.foo.bar mySchema.xsd", everything runs smoothly. What am I doing wrong here? Is there an error in the XML? Is MSXML to blame?
xsi:schemaLocation="..." is not a namespace definition, it is an attribute of the <Root> element which is in xsi namespace.
So removing this from the list of namespaces as you did is already the solution.