Subject: [xsl] how to avoid hardcoding xpath-default-namespace in xsl:stylesheet? From: Larry Evans <cppljevans@xxxxxxxxxxxxxx> Date: Fri, 11 Apr 2014 17:35:30 -0500 |
Hopefully the compilation at the bottom of this message should make clear what I'm after. But to be explicit, what do I put after
in the <xsl:stylesheet ... /> to retrieve the namespace used in source document.
-regards, Larry
---{compilation--- compilation; default-directory: "/home/evansl/prog_dev/xslt/sandbox/" -*- Compilation started at Fri Apr 11 17:05:57
make -k cat ./inp/defaultns.html <!--?xml version="1.0" encoding="utf-8"?--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!--Example of using default namespace --> <html xml:lang="en" xmlns="xxx" lang="en"> <head> <title>default namespace .html</title> </head> <body> <address>Nowhere</address> </body> </html> cat ./xfm/defaultns.xml <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xpath-default-namespace="xxx" ><!--How to avoid this hardcoding of xpath-default-namespace?--> <xsl:template match="html"> <xsl:copy-of select="."/> <xsl:text> </xsl:text> <xsl:text>@lang=</xsl:text> <xsl:value-of select="@lang"/> <xsl:text> </xsl:text> <xsl:text>@xmlns=</xsl:text> <xsl:value-of select="namespace::*[name() eq '']"/> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] [ANN] Published: XPath 3.0, X, Liam R E Quin | Thread | Re: [xsl] how to avoid hardcoding x, David Carlisle |
Re: [xsl] module extensibility, Liam R E Quin | Date | Re: [xsl] how to avoid hardcoding x, David Carlisle |
Month |