Re: [Xsltforms-support] XSLTForms and SVG
Brought to you by:
alain-couthures
|
From: Tim T. <tim...@gm...> - 2016-01-19 21:58:33
|
Alain, Excellent--thank you for the explanation and solution! What is it with Firefox and namespaces? :-) Best regards, Tim -- Tim A. Thompson Metadata Librarian (Spanish/Portuguese Specialty) Princeton University Library On Tue, Jan 19, 2016 at 1:08 PM, Alain Couthures < ala...@ag...> wrote: > Tim, > > Thank you for pointing at this issue! > > XSLTForms stylesheet has to deal with namespaces: the best approach for > browsers appears to deliver no namespace for HTML. Using <xsl:copy> is not > a good solution and using <xsl:element> and <xsl:attribute> allows to > remove the XHTML namespace. > > BTW, with the previous template, Saxon was complaining that attributes > cannot have attributes... > > So, I prefer improve the current templates with non-HTML namespaces > support, such as SVG, at least for elements: > > <xsl:template match="*" priority="-2" xmlns:xhtml= > "http://www.w3.org/1999/xhtml" <http://www.w3.org/1999/xhtml> xmlns:xsl= > "http://www.w3.org/1999/XSL/Transform" > <http://www.w3.org/1999/XSL/Transform>> > <xsl:param name="appearance" select="@appearance"/> > <xsl:param name="parentworkid"/> > <xsl:param name="workid" > select="concat(position(),'_',$parentworkid)"/> > <xsl:choose> > <xsl:when test="namespace-uri() != '' and namespace-uri() != ' > http://www.w3.org/1999/xhtml'"> > <xsl:element name="{local-name()}" > namespace="{namespace-uri()}"> > <xsl:apply-templates select="@*"/> > <xsl:apply-templates select="node()"> > <xsl:with-param name="parentworkid" select="$workid"/> > <xsl:with-param name="appearance" > select="$appearance"/> > </xsl:apply-templates> > </xsl:element> > </xsl:when> > <xsl:otherwise> > <xsl:element name="{local-name()}"> > <xsl:apply-templates select="@*"/> > <xsl:apply-templates select="node()"> > <xsl:with-param name="parentworkid" select="$workid"/> > <xsl:with-param name="appearance" > select="$appearance"/> > </xsl:apply-templates> > </xsl:element> > </xsl:otherwise> > </xsl:choose> > </xsl:template> > > I have successfully tested this with Firefox (Firefox is not anymore my > default browser because of too many conformance, performance and freeze > issues...). > > Thank you for your feedback! > > --Alain > > > Le 19/01/2016 14:11, Tim Thompson a écrit : > > Alain, > > I am hoping to do some work with XForms and SVG and have been looking at > the current XSLTForms SVG examples. I noticed that, since rev. 595 of > XSLTForms, none of the SVG examples work in Firefox. The reason seems to be > the changes made to the fallback identity template in xsltforms.xsl. > > In the latest revision, if lines 1203-1228[1] are reverted back to the > template used prior to rev. 595, then the SVG examples will work in Firefox: > > <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > match="node()|@*" priority="-2"> > <xsl:param name="appearance" select="@appearance"/> > <xsl:param name="parentworkid"/> > <xsl:param name="workid" > select="concat(position(),'_',$parentworkid)"/> > <xsl:copy> > <xsl:apply-templates select="@*"/> > <xsl:apply-templates select="node()"> > <xsl:with-param name="parentworkid" select="$workid"/> > <xsl:with-param name="appearance" select="$appearance"/> > </xsl:apply-templates> > </xsl:copy> > </xsl:template> > > Is there a reason not to use this more generic template? I tested on a > range of browsers and did not notice any immediate issues. > > Thanks again! > Tim > > [1] > https://github.com/AlainCouthures/xsltforms/blob/master/build/xsltforms.xsl#L1203 > > > -- > Tim A. Thompson > Metadata Librarian (Spanish/Portuguese Specialty) > Princeton University Library > > > |