Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3879360
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:43:03+00:00 2026-05-19T22:43:03+00:00

I have an XSLT stylesheet that processes an XML document to produce HTML. I’ve

  • 0

I have an XSLT stylesheet that processes an XML document to produce HTML.

I’ve realised that it’s possible to manipulate the site in such a way that the user can supply whatever XML they like – unfortunately this is unavoidable, and so I would like to protect myself from XSS (and other attacks) by ensuring that my XSLT stylesheet is capable of safely processing any document.

What do I need to be aware of to achieve this?

UPDATE:

I know that by default XSLT escapes output (which can be disabled by using the disable-output-escaping attribute) – is this enough to prevent someone from being able to inject malicious HTML elements and attributes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T22:43:03+00:00Added an answer on May 19, 2026 at 10:43 pm

    If you are processing XML data from an untrusted source and displaying the result on your website, always remember that it is not to be trusted.

    • You should never use xsl:copy or xsl:copy-of. If you copy nodes other than text directly, XSS attacks will be possible.
    • You should not use complicated or recursive rules. Specially crafted input can create a DoS by delaying the XSLT processing or making the processor crash.
    • Also, like you mentioned, do not disable output escaping.

    If you are passing the result of the transformation to an SQL server, you should not put any of the provided data in your SQL query.

    For example, this is BAD:

    <xsl:if test="@order">ORDER BY <xsl:value-of select="@order"/></xsl:test>
    

    This is GOOD:

    <xsl:if test="@order">ORDER BY
        <xsl:chose><xsl:when test="@order = 'foo'">foo</xsl:when> [...] </xsl:chose>
    </xsl:test>
    

    If you really need to pass data to your query, use bind variables.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XSLT stylesheet that transforms an XML file to JSON format and
i have to build an XSLT stylesheet that transforms an xml like this: <message>
I have a simply XSLT 1.0 stylesheet, that turns XML documents in XHTML. I
I currently have a XSLT 2.0 Stylesheet that I am trying to remove empty
I have got an XSLT that looks like this: <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output method=xml
Lets say I have a xslt stylesheet like the following: <?xml version=1.0 encoding=utf-8?> <xsl:stylesheet
I have an XML EDITED: <?xml version=1.0 encoding=UTF-8?> <?xml-stylesheet type=text/xsl href=xsl.xslt?> <CATALOG> <CD> </CD>
we have XSLT to transform XML into HTML in XHTML 1.0 Strict in XSLT
I have an xslt stylesheet that needs to call a C# XSLT extension function
I have this XSLT document : <xsl:stylesheet version=1.0 xmlns:mstns=http://www.w3.org/2001/XMLSchema xmlns=http://www.w3.org/2001/XMLSchema xmlns:xs=http://www.w3.org/2001/XMLSchema xmlns:msdata=urn:schemas-microsoft-com:xml-msdata xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.