Subject: Re: [xsl] matching attribute values with namespaces From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 12 Jul 2005 22:12:42 +0100 |
the namespace axis is your friend: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:variable name="ns" select="document/namespace::*"/> <xsl:template match="document"> <xsl:for-each select="$ns"> "<xsl:value-of select="name()"/>" is <xsl:value-of select="."/> </xsl:for-each> <xsl:apply-templates select="/*/*"/> </xsl:template> <xsl:template match="entry"> zzz[<xsl:value-of select="."/>] </xsl:template> <xsl:template match="entry[substring-before(@type,':')=name(/document/namespace::*[.='http://somewhere.com/'])]"> ABC![<xsl:value-of select="."/>] </xsl:template> </xsl:stylesheet> $ saxon ns.xml ns.xsl <?xml version="1.0" encoding="utf-8"?> "xml" is http://www.w3.org/XML/1998/namespace "providerns1" is http://somewhere.com/ "providerns2" is http://sometimes.com/ ABC![test] ABC![test] zzz[test] zzz[test] ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] matching attribute values, Christopher R. Maden | Thread | Re: [xsl] matching attribute values, Stefan Podkowinski |
Re: [xsl] matching attribute values, Christopher R. Maden | Date | Re: [xsl] matching attribute values, Stefan Podkowinski |
Month |