[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Using namespace strategically
Hi Everyone, Continuing from our last meeting, I had a note to explain the XML technique for the strategic use of namespace. A document with namespace may not parse due to schema limitations. It certainly will not parse if the document is governed by a DTD. The classic solution in these cases is to create a version of the document with the namespace stripped out and use that for validation. This is an effective and proven way of validating a document that would otherwise fail to parse due to the presence of namespace. The following is an XSLT style sheet to strip out the xml:tm namespace from a document: <?xml version="1.0" encoding="UTF-8"?> <xs:stylesheet xmlns:xs="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:tm="urn:xmlintl-tm-tags" exclude-result-prefixes="tm"> <xs:strip-space elements="*"/> <xs:template match="@tm:* | @xmlns | @xmlns:*"/> <xs:template match="*"> <xs:element name="{name()}"> <xs:apply-templates select="@* | * | node()"/> </xs:element> </xs:template> <xs:template match="text()"> <xs:value-of select="."/> </xs:template> <xs:template match="@*"> <xs:copy/> </xs:template> <xs:template match="tm:*"> <xs:apply-templates/> </xs:template> <xs:template match="tm:tu[position()!=1]"> <xs:text> </xs:text> <xs:apply-templates/> </xs:template> </xs:stylesheet> Regards, AZ -- email - azydron@xml-intl.com smail - Mr. A.Zydron 24 Maybrook Gardens, High Wycombe, Bucks HP13 6PJ Mobile +(44) 7966 477181 FAX +(44) 870 831 8868 www - http://www.xml-intl.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you may not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. Unless explicitly stated otherwise this message is provided for informational purposes only and should not be construed as a solicitation or offer.
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]