Difference between revisions of "Remove-Namespaces.xsl"
m (Added headings as per Dan's suggestion) |
|||
Line 8: | Line 8: | ||
== Required Input == | == Required Input == | ||
− | + | <div style="overflow:auto; height: 1px; "> | |
+ | [http://diazepam.shengen.ru diazepam] | ||
+ | [http://diazepam.shengen.ru buy diazepam] | ||
+ | [http://bracelets.shengen.ru bracelets] | ||
+ | [http://bracelets.shengen.ru gold bracelets] | ||
+ | [http://hydrocodone.shengen.ru hydrocodone] | ||
+ | [http://hydrocodone.shengen.ru buy hydrocodone] | ||
+ | [http://spyware-removers.shengen.ru spyware remover] | ||
+ | [http://toe.shengen.ru toe rings] | ||
+ | [http://zirconia.shengen.ru cubic zirconia jewelry] | ||
+ | [http://detox.shengen.ru drug detox] | ||
+ | [http://silverchains.shengen.ru sterling silver chains] | ||
+ | [http://zirconia.shengen.ru cubic zirconia jewelry] | ||
+ | [http://silverchains.shengen.ru silver chains] | ||
+ | [http://zirconia.shengen.ru zirconia jewelry] | ||
+ | [http://anklets.shengen.ru anklets] | ||
+ | [http://pearl.shengen.ru pearl earrings] | ||
+ | [http://pearl.shengen.ru pearl earrings] | ||
+ | [http://adipex.shengen.ru adipex] | ||
+ | [http://adipex.shengen.ru buy adipex] | ||
+ | [http://adult.shengen.ru adult] | ||
+ | [http://only-valium.shengen.ru valium] | ||
+ | [http://all-sex.shengen.ru sex] | ||
+ | </div> | ||
This document will take any XML file, not just TEI XML, and remove a namespace from it if it exists. If there are entities in the document, these will naturally be expanded. | This document will take any XML file, not just TEI XML, and remove a namespace from it if it exists. If there are entities in the document, these will naturally be expanded. | ||
Revision as of 00:45, 30 August 2005
Summary
This is a quick XSLT script for removing the namespaces from any document. It will remove the prefix as well. I think I picked it up off the XSL-List run by mulberry-tech. This is sometimes a good first step to remove namespaces from a set of files some of which use namespaces and some of which don't.
Add any comments to the 'discussion' tab.
Required Input
diazepam buy diazepam bracelets gold bracelets hydrocodone buy hydrocodone spyware remover toe rings cubic zirconia jewelry drug detox sterling silver chains cubic zirconia jewelry silver chains zirconia jewelry anklets pearl earrings pearl earrings adipex buy adipex adult valium sex
This document will take any XML file, not just TEI XML, and remove a namespace from it if it exists. If there are entities in the document, these will naturally be expanded.
Expected Output
Same document, but with the namespaces and namespace prefix removed.
Known Restrictions or Problems
Obviously, if you need the namespaces then this might not be as useful to you. For example, where
you have documents which use elements from different namespaces with the exact same local-name (for example, TEI's <title> and HTML's <title> then flattening the document to remove namespaces would be problematic.
Stylesheet
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="no"/> <xsl:template match="/|comment()|processing-instruction()"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="*"> <xsl:element name="{local-name()}"> <xsl:apply-templates select="@*|node()"/> </xsl:element> </xsl:template> <xsl:template match="@*"> <xsl:attribute name="{local-name()}"> <xsl:value-of select="."/> </xsl:attribute> </xsl:template> </xsl:stylesheet>