[xquery-talk] How do i remove namespaces?
Michael Kay
mhk at mhk.me.uk
Fri Jan 13 00:06:49 PST 2006
>
> declare function f:strip-namespace($e as element()) as element() {
> element {QName((), local-name($e)} {
> for $child in $e/(@*,node())
correction ----------------^
> return
> if ($child instance of element())
> then f:strip-namespace($child)
> else $child
> }
> }
>
> Michael Kay
> http://www.saxonica.com/
>
>
>
> ________________________________
>
> From: talk-bounces at xquery.com
> [mailto:talk-bounces at xquery.com] On Behalf Of Manolis Mylonakis
> Sent: 12 January 2006 18:29
> To: talk at xquery.com
> Subject: [xquery-talk] How do i remove namespaces?
>
>
>
> Hello,
>
>
>
> i have the following xml file:
>
>
>
>
>
> <Mpeg7 xmlns="urn:mpeg:mpeg7:schema:2001"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>
> <Description xsi:type="SemanticDescriptionType">
>
> <Semantics>
>
> <AbstractionLevel dimension="0"/>
>
> <Label>
>
> <Name>Soccer Agent Example</Name>
>
> </Label>
>
> <Property>
>
> <Name>Ontology</Name>
>
> <Definition>socceragents</Definition>
>
> </Property>
>
> <SemanticBase xsi:type="AgentObjectType" id="Moras">
>
> <AbstractionLevel dimension="0"/>
>
> <Label>
>
> <Name>Moras</Name>
>
> </Label>
>
> <Definition>
>
> <FreeTextAnnotation>Vaggelis Moras</FreeTextAnnotation>
>
> </Definition>
>
> <Agent xsi:type="PersonType">
>
> <Name>
>
> <FamilyName initial="M">Moras</FamilyName>
>
> <GivenName>Vaggelis</GivenName>
>
> </Name>
>
> <ElectronicAddress>
>
> <Email>players at aekfc.gr</Email>
>
> </ElectronicAddress>
>
> </Agent>
>
> </SemanticBase>
>
> </Semantics>
>
> <Semantics>
>
> <AbstractionLevel dimension="0"/>
>
> <Label>
>
> <Name>Soccer Agent Example</Name>
>
> </Label>
>
> <Property>
>
> <Name>teacher </Name>
>
> <Definition>university teacher</Definition>
>
> </Property>
>
> <SemanticBase xsi:type="AgentObjectType" id="Moras">
>
> <AbstractionLevel dimension="0"/>
>
> <Label>
>
> <Name>Dolas</Name>
>
> </Label>
>
> <Definition>
>
> <FreeTextAnnotation>Apostolos Dolas</FreeTextAnnotation>
>
> </Definition>
>
> <Agent xsi:type="PersonType">
>
> <Name>
>
> <FamilyName initial="M">Dolas</FamilyName>
>
> <GivenName>Apostolos</GivenName>
>
> </Name>
>
> <ElectronicAddress>
>
> <Email>dol at mymail.gr</Email>
>
> </ElectronicAddress>
>
> </Agent>
>
> </SemanticBase>
>
> </Semantics>
>
> </Description>
>
> </Mpeg7>
>
>
>
>
>
>
>
>
>
> And my xquery is :
>
>
>
> declare namespace Mpeg7="urn:mpeg:mpeg7:schema:2001";
>
> for $x in doc("myPersons.xml")//Mpeg7:Agent
>
> return $x
>
>
>
>
>
> One of my results is the following :
>
> <Agent xsi:type="PersonType"
> xmlns="urn:mpeg:mpeg7:schema:2001"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>
> <Name xmlns="urn:mpeg:mpeg7:schema:2001">
>
> <FamilyName initial="M">Moras</FamilyName>
>
> <GivenName>Vaggelis</GivenName>
>
> </Name>
>
> <ElectronicAddress>
>
> <Email
> xmlns="urn:mpeg:mpeg7:schema:2001">players at aekfc.gr</Email>
>
> </ElectronicAddress>
>
> </Agent>
>
>
>
>
>
> I am looking for a way ro remove the namespaces
>
> for example i want to my results looks like the following :
>
>
>
>
>
> <Agent type="PersonType">
>
> <Name>
>
> <FamilyName initial="M">Moras</FamilyName>
>
> <GivenName>Vaggelis</GivenName>
>
> </Name>
>
> <ElectronicAddress>
>
> <Email>players at aekfc.gr</Email>
>
> </ElectronicAddress>
>
> </Agent>
>
>
>
> Could any body help me please?
>
> Thanks in advance
>
> Manolis
>
>
>
>
>
>
More information about the talk
mailing list