Export to XML in SSRS Report Builder: Create an XMLTag that contains both attribute(s) and content

Wesley Viaene 0 Reputation points
2024-07-11T08:18:14.01+00:00

I want to use SSRS Report Builder to export generated reports to XML

The problem I encounter is that whatever I try, the result is always something like:

<project projectcode="2400928">
<element2>TEST</element2>
</project>

While I need it to be as follow:
<project projectcode="2400928">TEST</project>

A field on the report can either be an attribute or it can create a separate element
But I would like a field to be the content of an XML tag without creating new elements

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,860 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ZoeHui-MSFT 34,996 Reputation points
    2024-07-12T05:23:25.5333333+00:00

    Hi @Wesley Viaene,

    Not sure if you are looking for XSLT transformations.

    The XML renderer can apply a server-side XSLT transformation to the original XML data. When an XSLT is applied, the renderer outputs the transformed content instead of the original XML data. The transformation occurs on the server, not on the client.

    The XSLT to apply to the output is defined either in the report definition file with the DataTransform property of the report. Alternatively, it can be specified with the XSLT DeviceInfo parameter.

    If either of these values are set, the transform occurs each time the XML renderer is used. When you use subscriptions, the XSLT must be defined in the RDL DataTransform property.

    If an XSLT file is specified, by both the DataTransform definition property and the device information setting, the XSLT specified in DataTransform occurs first, followed by the XSLT set by the device information settings.

    A same thread here you may take a reference to.

    SSRS Export report to XML and drop <Report> Element

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments