Click here to Skip to main content
14,386,289 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am trying to sort the data in an xml file before creating reports of the data.

My xml file is like
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE SpringOpen SYSTEM "Seniors_Open.dtd"[]>
    <Club1>Man United</Club1>

I am trying to sort the data by the element TeamNumber

my XSL file is
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
  <xsl:strip-space elements="*"/>
  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="SpringOpen">
      <xsl:apply-templates select="Team">
        <xsl:sort select="TeamNumber" data-type="text"/>

  <xsl:template match="@* | node()">
      <xsl:apply-templates select="@* | node()"/>


What I have tried:

My is
Dim xslt As New XslCompiledTransform()
        xslt.Load(Path & "\Spring_Open.xsl")

        ' Execute the transform and output the results to a file.
        xslt.Transform(Path & "\Spring_Open.xml", Path & "\sortedSpring_Open.xml")

The error I get when executing the transform is
System.Xml.XmlException: 'For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method.'

Being an absolute novice I do not understand what the error means!
Can anyone help to solve my problem.

I have deleted
<!DOCTYPE SpringOpen SYSTEM "Seniors_Open.dtd"[]>
from my xml file and it now works Why?
Updated 26-Oct-19 10:21am

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100