itcouple
asked on
XSLT issue with SSRS 2008 (works fine with 2008 R2)
Hi
I use SSRS + XSLT to generate XML and this code works perfectly when I use BIDS and when I use deployed report to SSRS 2008 R2
However it doesn't work properly with 2008 I get certain elements but no data related to XML at all (The report itself runs fine)
For comparison less effective approach works fine both on 2008 and 2008 R2
See below
There are no differences between XML files (2008/2008 R2) apart from slight change in server path which is expected.
I suspect/hope 2008 doesn't like only certain elements of the code and some modifications might work.
If anyone had similar experience in the past or have suggestions I would appreciate your help.
Many thanks
Emil
I use SSRS + XSLT to generate XML and this code works perfectly when I use BIDS and when I use deployed report to SSRS 2008 R2
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:lgw="LineGraphWidget"
exclude-result-prefixes="lgw"
version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="/">
<xsl:element name="graphs">
<xsl:element name="graphconfig">
<xsl:attribute name="colorSet">
<xsl:value-of select="'mixColors'"/>
</xsl:attribute>
<xsl:attribute name="minVal">
<xsl:value-of select="0"/>
</xsl:attribute>
<xsl:attribute name="maxVal">
<xsl:value-of select="100"/>
</xsl:attribute>
<xsl:attribute name="inte">
<xsl:value-of select="50"/>
</xsl:attribute>
<xsl:apply-templates select="//lgw:Details1"/>
</xsl:element>
<xsl:element name="graphholder">
<xsl:apply-templates select="//lgw:ResultCategoryNode"/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="lgw:Details1">
<xsl:element name="graph">
<xsl:attribute name="name">
<xsl:value-of select="@ConfigMonth"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
<xsl:template match="lgw:ResultCategoryNode">
<xsl:element name="{concat('graph', position())}">
<xsl:attribute name="Name">
<xsl:value-of select="@ResultCategoryFieldCategory"/>
</xsl:attribute>
<xsl:apply-templates select=".//lgw:ResultDetailsNode">
</xsl:apply-templates>
</xsl:element>
</xsl:template>
<xsl:template match="lgw:ResultDetailsNode">
<xsl:element name="graph">
<xsl:attribute name="value">
<xsl:value-of select="@ResultFieldNoOfJobs"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
However it doesn't work properly with 2008 I get certain elements but no data related to XML at all (The report itself runs fine)
For comparison less effective approach works fine both on 2008 and 2008 R2
See below
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:lgw="LineGraphWidget"
exclude-result-prefixes="lgw"
version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="/">
<graphholder>
<xsl:for-each select="(//*[local-name()='ResultCategoryNode'])">
<xsl:variable name="MyCategory" select="@ResultCategoryFieldCategory" />
<xsl:element name="{concat('graph', position())}">
<xsl:attribute name="Name">
<xsl:value-of select="@ResultCategoryFieldCategory"/>
</xsl:attribute>
<xsl:for-each select="(//*[local-name()='ResultDetailsNode'])[@JobStatus=$MyCategory]">
<graph>
<xsl:attribute name="Value">
<xsl:value-of select="@ResultFieldNoOfJobs"/>
</xsl:attribute>
</graph>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</graphholder>
</xsl:template>
</xsl:stylesheet>
There are no differences between XML files (2008/2008 R2) apart from slight change in server path which is expected.
I suspect/hope 2008 doesn't like only certain elements of the code and some modifications might work.
If anyone had similar experience in the past or have suggestions I would appreciate your help.
Many thanks
Emil
There are more differences between your two XSLTs other than the namespace difference.
The first thing you should test is namespace dependence.
As I told you in the other question, I am very suspicious about a default namespace switch
CAn you test the below stylesheet to work with both versions of the reporter?
If they do, then the conclusion is that the reporter changed the namespace of your XML
The first thing you should test is namespace dependence.
As I told you in the other question, I am very suspicious about a default namespace switch
CAn you test the below stylesheet to work with both versions of the reporter?
If they do, then the conclusion is that the reporter changed the namespace of your XML
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="/">
<xsl:element name="graphs">
<xsl:element name="graphconfig">
<xsl:attribute name="colorSet">
<xsl:value-of select="'mixColors'"/>
</xsl:attribute>
<xsl:attribute name="minVal">
<xsl:value-of select="0"/>
</xsl:attribute>
<xsl:attribute name="maxVal">
<xsl:value-of select="100"/>
</xsl:attribute>
<xsl:attribute name="inte">
<xsl:value-of select="50"/>
</xsl:attribute>
<xsl:apply-templates select="//*[local-name() ='lgw:Details1']"/>
</xsl:element>
<xsl:element name="graphholder">
<xsl:apply-templates select="//*[local-name() ='ResultCategoryNode']"/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="*[local-name() ='Details1']">
<xsl:element name="graph">
<xsl:attribute name="name">
<xsl:value-of select="@ConfigMonth"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
<xsl:template match="*[local-name() ='ResultCategoryNode']">
<xsl:element name="{concat('graph', position())}">
<xsl:attribute name="Name">
<xsl:value-of select="@ResultCategoryFieldCategory"/>
</xsl:attribute>
<xsl:apply-templates select=".//*[local-name() ='ResultDetailsNode']">
</xsl:apply-templates>
</xsl:element>
</xsl:template>
<xsl:template match="*[local-name() ='ResultDetailsNode']">
<xsl:element name="graph">
<xsl:attribute name="value">
<xsl:value-of select="@ResultFieldNoOfJobs"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
ASKER
Hi
I tried the code and it worked in both cases.
When I export the report as XML without XSL they look pretty the same (see attached)
Does it mean it changes something after that point?
Regards
Emil
XSLTIssue.txt
I tried the code and it worked in both cases.
When I export the report as XML without XSL they look pretty the same (see attached)
Does it mean it changes something after that point?
Regards
Emil
XSLTIssue.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sorry, forgot the XSLT
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="node()">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
ASKER
Hi
Here is output in 2008
<Report Name="LineGraphWidget_Test ">
and 2008 R2
Report Name="LineGraphWidget_Test " xmlns="LineGraphWidget_Tes t">
It does lose the namespace... I will check if it was raised on connect, maybe they fix that in SP (I doubt it: p)
Many thanks for solving the mistery!
Emil
Here is output in 2008
<Report Name="LineGraphWidget_Test
and 2008 R2
Report Name="LineGraphWidget_Test
It does lose the namespace... I will check if it was raised on connect, maybe they fix that in SP (I doubt it: p)
Many thanks for solving the mistery!
Emil
welcome,
I did some reading and found out that messing up the namespace is a bug found right after releasing 2008.
(from what I understand)
Another possibility is that the config for both is different
aparently: "try setting the "OmitSchema" deviceInfo to true in your rsreportserver.config"
if you do that the namespace gets dropped.
Could be that one setting has this as "true" the other as "false"
If that is teh case. I recommend that you set it to true
so you don't have to bother with the namespace and use
<xsl:apply-templates select="//Details1"/>
instead of
<xsl:apply-templates select="//lgw:Details1"/>
For readibility and performansce, it would be good to play around a bit with the namespace settings in the config,
so your XSLT could be cleaner
I did some reading and found out that messing up the namespace is a bug found right after releasing 2008.
(from what I understand)
Another possibility is that the config for both is different
aparently: "try setting the "OmitSchema" deviceInfo to true in your rsreportserver.config"
if you do that the namespace gets dropped.
Could be that one setting has this as "true" the other as "false"
If that is teh case. I recommend that you set it to true
so you don't have to bother with the namespace and use
<xsl:apply-templates select="//Details1"/>
instead of
<xsl:apply-templates select="//lgw:Details1"/>
For readibility and performansce, it would be good to play around a bit with the namespace settings in the config,
so your XSLT could be cleaner
ASKER
Gertone,
I will be honest with you..... I won't bother :) It is working currently on 2008 and 2008 R2 and that is good enough for me.
Just out of interested I am working on something and came across limitations of SSRS/SSAS and I wonder if you have any ideas how to make it work.....
I have SSRS Report which extract field data based on this
<?xml version="1.0" encoding="utf-8"?><Field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:type="Level" UniqueName="[Dim Job Status].[Job Status].[Job Status]" />
The problem I have is that I want to make my query (MDX) generic so I can issue different MDX using the same report/XSLT. The problem I have is that I cannot neither rename my field to something generic using MDX nor change that in SSRS designer (dataset). So my only hope is too look into this understabloe for me code which is generate automatically and hope that I can modify it for me own needs....
Again many thanks for sharing your knowledge!
Emil
I will be honest with you..... I won't bother :) It is working currently on 2008 and 2008 R2 and that is good enough for me.
Just out of interested I am working on something and came across limitations of SSRS/SSAS and I wonder if you have any ideas how to make it work.....
I have SSRS Report which extract field data based on this
<?xml version="1.0" encoding="utf-8"?><Field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:type="Level" UniqueName="[Dim Job Status].[Job Status].[Job Status]" />
The problem I have is that I want to make my query (MDX) generic so I can issue different MDX using the same report/XSLT. The problem I have is that I cannot neither rename my field to something generic using MDX nor change that in SSRS designer (dataset). So my only hope is too look into this understabloe for me code which is generate automatically and hope that I can modify it for me own needs....
Again many thanks for sharing your knowledge!
Emil
usualy "*" is your friend if you want to do that
"*" is a wildcard for elements
"*[1]" would be the first child element
you can play with that and come up with a generic XSLT if you want
"*" is a wildcard for elements
"*[1]" would be the first child element
you can play with that and come up with a generic XSLT if you want
ASKER
Thanks I tried that.... and unfortunatelly didn't work. There is type in this code with Level but also Measure (If I could just use 'Set; that would work)..... Anyway I found ugly solution where I just add fields I want with XML for all my queries and during execution there are ignored and the report still runs. Ugly but should be fine for the time being.
Regards
Emil
Regards
Emil
OK, cheers
ASKER
I have replaced
//lgw:
with
//*[local-name()='
and that seem to resolve the issue.
Any comments about the incompatibility core reasons are still welcome :)
Regards
Emil