Subject: RE: [xsl] xsl:result-document and Saxon serializer problems From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Sun, 21 Aug 2005 13:25:32 +0100 |
I suspect the answer to questions 1 and 2 lies in the bits of the stylesheet that you haven't shown us. The answer to question 3 is that you seem to have misunderstood exclude-result-prefixes: (a) it only affects the behavior of literal result elements, and I don't see any literal result elements in your code (b) its scope is static rather than dynamic. If you put the attribute on an element such as xsl:result-document, it only affects literal result elements that are physically contained within that xsl:result-document element. To work out where the "thin air" attributes are coming from, I can assure you Saxon isn't making them up! You might find that the -T trace option helps with your debugging. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Kenneth Stephen [mailto:marvin.the.cynical.robot@xxxxxxxxx] > Sent: 21 August 2005 05:24 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] xsl:result-document and Saxon serializer problems > > Hi, > > I have the following input data : > > <?xml version="1.0" encoding="UTF-8" standalone="no"?> > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" > "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> > <svg xmlns="http://www.w3.org/2000/svg" > xmlns:img-parms="http://xml.megadodo.umb/svg" > img-parms:width="" img-parms:height="" img-parms:x="" > img-parms:y=""> > <rect img-parms:x="" img-parms:y="" img-parms:width="" > img-parms:height="" > img-parms:rx="" img-parms:ry="" img-parms:style=""> > <img-parms:data /> > </rect> > </svg> > > ....and the following code : > > <xsl:result-document href="{$svg-filename}" > doctype-public="-//W3C//DTD SVG 1.1//EN" > > doctype-system="http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > exclude-result-prefixes="img-parms"> > <xsl:call-template name="create-svg"> > <xsl:with-param > name="template-name" > select="concat($config-dir,$chart-name,'Template.xml')" /> > <xsl:with-param > name="img-width" select="$width" /> > <xsl:with-param > name="img-height" select="$height" /> > </xsl:call-template> > </xsl:result-document> > > <xsl:template name="create-svg"> > <xsl:param name="template-name" /> > <xsl:param name="img-width" /> > <xsl:param name="img-height" /> > > <xsl:if test="$template-name = '' or $img-width = '' or > $img-height = ''"> > <xsl:message terminate="yes">Invalid input > parameters</xsl:message> > </xsl:if> > <xsl:apply-templates > select="document($template-name)/*" mode="chart"> > <xsl:with-param name="template-name" > select="$template-name"/> > <xsl:with-param name="img-width" select="$img-width" /> > <xsl:with-param name="img-height" > select="$img-height" /> > </xsl:apply-templates> > </xsl:template> > > <xsl:template match="@*[namespace-uri() != > 'http://xml.megadodo.umb/svg'] | > node()[namespace-uri() != > 'http://xml.megadodo.umb/svg']" mode="chart" > > <xsl:param name="template-name" /> > <xsl:param name="img-width" /> > <xsl:param name="img-height" /> > > <xsl:copy> > <xsl:apply-templates select="@*|node()" mode="chart"> > <xsl:with-param > name="template-name" select="$template-name"/> > <xsl:with-param name="img-width" > select="$img-width" /> > <xsl:with-param name="img-height" > select="$img-height" /> > </xsl:apply-templates> > </xsl:copy> > </xsl:template> > > <xsl:template match="@*[namespace-uri() = > 'http://xml.megadodo.umb/svg']" mode="chart"> > <xsl:param name="template-name" /> > <xsl:param name="img-width" /> > <xsl:param name="img-height" /> > > <xsl:attribute name="{local-name()}"> > <xsl:choose> > <xsl:when test="local-name() = 'height'"> > <xsl:value-of select="$img-height" /> > </xsl:when> > <xsl:when test="local-name() = 'width'"> > <xsl:value-of select="$img-width" /> > </xsl:when> > <xsl:when test="local-name() = 'x' and > ../local-name() = 'svg'"> > <xsl:value-of select="'0'" /> > </xsl:when> > <xsl:when test="local-name() = 'y' and > ../local-name() = 'svg'"> > <xsl:value-of select="'0'" /> > </xsl:when> > <xsl:when test="local-name() = 'x' and > ../local-name() = 'rect'"> > <xsl:value-of select="'0'" /> > </xsl:when> > <xsl:when test="local-name() = 'y' and > ../local-name() = 'rect'"> > <xsl:value-of select="'0'" /> > </xsl:when> > <xsl:when test="local-name() = 'style'"> > <xsl:value-of > select="'fill:yellow;stroke:black'" /> > </xsl:when> > <xsl:otherwise /> > </xsl:choose> > </xsl:attribute> > </xsl:template> > > <xsl:template match="img-parms:data" mode="chart" /> > > <xsl:template match="text()[../local-name() = 'rect']" > mode="chart" priority="2" /> > > This produces the following output : > > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE svg > PUBLIC "-//W3C//DTD SVG 1.1//EN" > "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> > <svg xmlns="http://www.w3.org/2000/svg" > xmlns:img-parms="http://xml.megadodo.umb/svg" > xmlns:xlink="http://www.w3.org/1999/xlink" width="500" height="500" > x="0" y="0" preserveAspectRatio="xMidYMid meet" zoomAndPan="magnify" > version="1.1" contentScriptType="text/ecmascript" > contentStyleType="text/css"> > <rect x="0" y="0" width="500" height="500" rx="" ry="" > style="fill:yellow;stroke:black"/> > </svg> > > Questions: > > 1. Why is the saxon serializer defining the namespace of xlink on the > svg element? > 2. Where in heavens name are the preserveAspectRation, zoomAndPan, > etc attributes coming from? Saxon appears to be conjuring them out of > thin air. > 3. The XSLT 2.0 draft specifies that.... > > <quote> > 3.5 Standard Attributes > > [Definition: There are a number of standard attributes that may appear > on any XSLT element: specifically version, exclude-result-prefixes, > extension-element-prefixes, xpath-default-namespace, > default-collation, and use-when.]</quote> > > ....and saxon appears to be ignoring the exclude-result-prefixes > that I've specified on the result-document element. Is this valid > behaviour? > > Thanks, > Kenneth
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl:result-document and S, Colin Paul Adams | Thread | Re: [xsl] xsl:result-document and S, Kenneth Stephen |
RE: [xsl] How to do an OR within SE, Michael Kay | Date | RE: [xsl] Saxon xml parser error, Michael Kay |
Month |