To guarantee that any XSL transformation output is a well-formed document, the angle bracket characters (< and >) are transformed by default into "<" and ">" character sequences. However, sometimes this behavior is not desirable, such as when you want to generate a Document Type Declaration (DTD) in the output document:
<!DOCTYPE StaffMember [
<!ELEMENT StaffMember (#PCDATA)>
- Microsoft XML version 3.0 or later
- XML and XSL transformations and the MSXML component
- Visual Basic Scripting Edition (VBScript)
- XML Document Object Model (DOM)
- Open a text editor such as Notepad, and then paste the following XML in a document:
<?xml-stylesheet type="text/xsl" href="Transform.xsl"?>
- Save this file as Source.xml.
- Create a new file in your text editor, and then paste the following XSL style sheet in the file. Notice the disable-output-escaping="yes" attribute in the first xsl:value-of tag:
<xsl:output method="xml" omit-xml-declaration="yes"/>
select="concat('<!DOCTYPE StaffMember [',
'<!ELEMENT StaffMember (#PCDATA)>',
- Save this file as Transform.xsl in the same folder as the XML document that you just created.
- Create a new file in your text editor, and then paste the following script in the file:
Set objSource = CreateObject("MSXML2.DOMDocument")
objSource.async = False
Set objTransform = CreateObject("MSXML2.DOMDocument")
objTransform.async = False
sResult = objSource.TransformNode(objTransform.documentElement)
- Save this file as Xform.vbs in the same folder as the XML document and the XSL style sheet that you just created.
- Open a command prompt, and then locate the folder that contains your three files.
- Type cscript xform.vbs at the command prompt.
- The output from the transformation is displayed as follows on the screen:
<!DOCTYPE StaffMember [<!ELEMENT StaffMember (#PCDATA)>]>
ID articol: 315717 - Ultima examinare: 22 iun. 2014 - Revizie: 1