xslt - Removing an XML tag that is named like xfdf:field (with a namespace) -


i want remove xml element xml file. tag want remove named xfdf:field. how specify in xslt ? tried , getting error saything "org.apache.xpath.domapi.xpathstylesheetdom3exception: prefix must resolve namespace: xfdf ".

here xslt.

<xsl:stylesheet version="1.0"     xmlns:xsl="http://www.w3.org/1999/xsl/transform">     <xsl:output omit-xml-declaration="yes" />     <xsl:template match="node()|@*">         <xsl:copy>             <xsl:apply-templates select="node()|@*" />         </xsl:copy>     </xsl:template>     <xsl:template match="xfdf:field"></xsl:template> </xsl:stylesheet> 

here xml.

<xfa:datasets   xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"  xmlns:dd="http://ns.adobe.com/data-description/" xmlns:tns="http://hostname"  xmlns:xfdf="http://ns.adobe.com/xfdf/">     <xfa:data>         <tns:form xmlns:xsi="http://www.w3.org/2001/xmlschema-instance">             <tns:formheader>                 <tns:formid>formid</tns:formid>                 <tns:revid>rev123</tns:revid>                 <tns:agencyid>agency</tns:agencyid>                 <tns:progid>program</tns:progid>                 <tns:serviceid>service</tns:serviceid>             </tns:formheader>             <tns:formfields>                 <tns:date>08-13-1967</tns:date>                 <tns:agreementbetween></tns:agreementbetween>                 <tns:ncr>xxxx</tns:ncr>                 <tns:formconfirmationinfo>                     <tns:confnbrlbl>nbrlabel</tns:confnbrlbl>                     <tns:confnbrdata>1231</tns:confnbrdata>                     <tns:custnamelbl>3332</tns:custnamelbl>                     <tns:custnamedata>dasdas</tns:custnamedata>                     <tns:datelbl>date</tns:datelbl>                     <tns:datedata>01012001</tns:datedata>                 </tns:formconfirmationinfo>             </tns:formfields>             <xfdf:field xmlns:xfdfi="http://ns.adobe.com/xfdf-transition/"                         xfdfi:original="fsapplicationdata_">                 <!--irrelevant data omitted-->             </xfdf:field>         </tns:form>     </xfa:data> </xfa:datasets> 

you need specify namespace in xslt file:

<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0"          xmlns:xsl="http://www.w3.org/1999/xsl/transform"           xmlns:xfdf="http://ns.adobe.com/xfdf/"> 

Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -