Matching elements with namespace prefix in XSLT -
this xml input.
<package version="2.0" unique-identifier="uuid_id" xmlns="http://www.idpf.org/2007/opf"> <metadata xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:calibre="http://calibre.kovidgoyal.net/2009/metadata" xmlns:dc="http://purl.org/dc/elements/1.1/"> <meta name="calibre:series_index" content="1"/> <dc:language>und</dc:language> <dc:creator opf:file-as="marquez, gabriel garcia" opf:role="aut" >gabriel garcia marquez</dc:creator> <meta name="calibre:timestamp" content="2010-07-14t21:35:15.266000+00:00"/> <dc:title>cem anos de solidão</dc:title> <meta name="cover" content="cover"/> <dc:date>2010-07-14t21:35:15.266000+00:00</dc:date> <dc:contributor opf:role="bkp" >calibre (0.7.4) [http://calibre-ebook.com]</dc:contributor> <dc:identifier id="uuid_id" opf:scheme="uuid" >7e11dc8b-55cb-4411-8f30-df974fbcf58a</dc:identifier> </metadata> <manifest> </package>
and xslt starts like..
<?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <xsl:template match="package"> <xsl:message>entering package</xsl:message> </xsl:template>
i using xslt 1.0
, template package not getting matched. when remove namespace xmlns="http://www.idpf.org/2007/opf"
in package node, template gets matched. how can make template match without removing namespaces.
please me. in advance.
add namespaces in stylesheet.
<?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:opf="http://www.idpf.org/2007/opf"> <xsl:template match="opf:package"> <xsl:message>entering package</xsl:message> </xsl:template>
Comments
Post a Comment