Hi,
My friend and colleague sent me some XSL which he asked me to validate the
output XML. The output includes namespaces for the XSDs but also some of the
namespaces that he used for functions that generated some of the element
content. For example, xmlns:util="java:java.util.UUID" to generate a UUID for
the gmd:fileIdentifier element. If he removes these namespaces from the XSL of
course the transformation fails. If he includes them the transformation is
successful but I don't see how to get rid of the namespaces and attributes for
the unwanted namespaces in the output XML.
For example I don't want the xmlns:dif, xmlns:fn, xmlns:util namespaces as
attributes in the root element and I also don't want the xmls:srv attribute in
the elements.
How do I get rid of this content?
Thanks.
John
Here is the head of the XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:gco="http://www.isotc211.org/2005/gco"
xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:gts="http://www.isotc211.org/2005/gts"
xmlns:gsr="http://www.isotc211.org/2005/gsr"
xmlns:gss="http://www.isotc211.org/2005/gss"
xmlns:gmx="http://www.isotc211.org/2005/gmx"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:util="java:java.util.UUID"
xmlns:dif="http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/"
xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
xsi:schemaLocation="http://www.isotc211.org/2005/gmd
http://www.isotc211.org/2005/gmd/gmd.xsd http://www.opengis.net/gml
http://www.isotc211.org/2005/gml/gml.xsd http://www.w3.org/1999/xlink
http://www.isotc211.org/2005/xlink/xlinks.xsd">
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"
media-type="text/plain"/>
<!--<xsl:strip-space elements="*"/> -->
<!-- MATCH ROOT DIF -->
<xsl:template match="dif:DIF">
<!-- PRINT Dataset HEADER MATERIAL -->
<gmd:MD_Metadata
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:gco="http://www.isotc211.org/2005/gco"
xmlns:gts="http://www.isotc211.org/2005/gts"
xmlns:gsr="http://www.isotc211.org/2005/gsr"
xmlns:gss="http://www.isotc211.org/2005/gss"
xmlns:gmx="http://www.isotc211.org/2005/gmx"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xlink="http://www.w3.org/1999/xlink"
xsi:schemaLocation="http://www.isotc211.org/2005/gmd
http://www.isotc211.org/2005/gmd/gmd.xsd
http://www.isotc211.org/2005/gco
http://www.isotc211.org/2005/gco/gco.xsd
http://www.isotc211.org/2005/gts
http://www.isotc211.org/2005/gts/gts.xsd
http://www.isotc211.org/2005/gsr
http://www.isotc211.org/2005/gsr/gsr.xsd
http://www.isotc211.org/2005/gss
http://www.isotc211.org/2005/gss/gss.xsd">
<gmd:fileIdentifier>
<gco:CharacterString>
<xsl:variable name="uid"
select="util:toString(util:randomUUID())"/>
<xsl:value-of select="$uid"/>
</gco:CharacterString>
</gmd:fileIdentifier>
...
_______________________________________________
oXygen-user mailing list
[email protected]
http://www.oxygenxml.com/mailman/listinfo/oxygen-user