Re: filtering elements using identity transform
> An article I read on the web Not a good article I would guess. > discouraged using local-name b'cos it strips the prefixes. using local-name makes sense iff you want to just match on the local name, ignoring namespaces, which you would want to do here, if you can't change your input format. So this is a possibility. > The recommended one was > <xsl:template match="node()[not(starts-with(name(), "b:"))]. No, that form is almost always (actually I would say always) a bad idea as it is matching on a specific prefix rather than the namespace name (ie the URI associated with the namespace). Really, if you have control over your input format you would be in a much better position if you used xhtml for the html elements and the v3 namespace for the v3 elements, used like this <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v3="urn:hl7-org/v3"> <head> </head> <body> <p> <table> <tr> <v3:slideshow author="Yours Truly" title="Sample Slide Show" date ="Date of publication" > <td> </td> By using a v3: prefix on the slideshow element uyou avoid polluting the nested elements into that namespace so they are still xhtml. In the XSLT you then no longer needs separate templates for all the html elements you can simply do <xsl:template match="h:*" > an xhtml element was here <xsl:apply-templates/> </xsl:template> <xsl:template match="v3:*"> an v3 element is copied <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> so long as you have xmlns:v3="urn:hl7-org/v3" xmlns:h="http://www.w3.org/1999/xhtml" on your xsl:stylesheet so these namespaces are in scope in the stylesheet. David ________________________________________________________________________ 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 ________________________________________________________________________
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format