[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] xsl -- Inserting a DOCTYPE if needed
How would write a XSL file that inserts the DOCTYPE only and only if not present? // Source 1 //-- HAS DOCTYPE <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE RootElement SYSTEM "../DTDs/RootElement.dtd"> <RootElement> ... ... </RootElement> // Source 2 //-- NO DOCTYPE <?xml version="1.0" encoding="UTF-8"?> <RootElement> ... ... </RootElement> // XSL FILE <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <!-- This is what I need to make conditional --> <!-- If the DOCTYPE is not found insert the DOCTYPE with this xsl output --> <xsl:output method="xml" indent="yes" doctype-public="some_URI" doctype-system ="path/dtdFile.dtd"/> <!-- BUT I DON'T KNOW ENOUGH ABOUT XSL TO CHECK FOR DOCTYPE --> <!-- This makes a copy of the RootElements--> <xsl:template match="RootElement"> <xsl:copy-of select="../*"/> </xsl:template> </xsl:stylesheet> Thanks
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|