Re: [xsl] Problem generating combining SVG documents using XSLT

Subject: Re: [xsl] Problem generating combining SVG documents using XSLT
From: Jiri Jirat <Jiri.Jirat@xxxxxxxxx>
Date: Fri, 02 Feb 2001 09:57:01 +0100
Hi David,
 I think I have been facing the same problem some time ago.
I bet one Pilsner beer that you use Adobe plug-in.

Currently there are _four_ namespaces for SVG.
http://www.w3.org/2000/svg
http://www.w3.org/2000/svg-20000303-exchange
http://www.w3.org/2000/svg-20000303-stylable
and Mozilla's experimental (temporary?) namespace.

Relevant links are stored in our Namespace Reference:
http://www.zvon.org/index.php?nav_id=172

Try the following DTD's:

http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-shared.dtd

http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd

http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-exchange.dtd



Best regards
Jirka




"Kane, David" wrote:
> 
> Folks,
> 
> I am trying to combine and transform a number of SVG documents using Xalan.
> The problem is that as part of the output generation the processor is
> inserting attribute nodes specified as FIXED or IMPLIED in the document DTD.
> The problem, in particular is that when the root svg node of the output
> document has an xmlns attribute (which is specified as FIXED in the DTD, my
> SVG viewer balks at displaying the document.  If I edit the attribute out,
> after the face, the resulting document appears to work fine.
> 
> My question is, how can I prevent these additional nodes from appearing in
> my output document?  I've tried to strip my SVG documents, and the
> stylesheet to the essentail elements, and they are listed below:
> 
> Thanks!
> 
> Sincerely,
> David Kane
> david_kane@xxxxxxx
> 
> RESULTING SVG DOCUMENT:
> ---------------------------------------------
> <?xml version="1.0" encoding="iso-8859-1"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102 Stylable//EN"
> "http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd";>
> 
>                                                 <!-- ***** THIS IS THE
> TROUBLESOME
>                                                              ATTRIBUTE -->
> <svg viewBox="50 300 400 1050" xmlns="http://www.w3.org/2000/svg";
> xmlns:svg="http://www.w3.org/2000/svg"; id="file1" xml:space="preserve"
> preserveAspectRatio="xMidYMid meet" zoomAndPan="magnify"
> contentScriptType="text/ecmascript" contentStyleType="text/css">
>         <rect id="ABCD" x="210" y="575" width="35" height="7.65354312"
> style="fill:white; stroke:black; stroke-width:1"/>
>         <text>
>             <tspan x="250" y="578.82677156">ABCD</tspan>
>         </text>
>         <rect id="EFGH" x="210" y="582.65354312" width="35"
> height="7.65354312" style="fill:lightgray; stroke:black; stroke-width:1"/>
>         <text>
>             <tspan x="255" y="586.48031468">EFGH</tspan>
>         </text>
> 
>         <rect id="IJKL" viewBox="50 300 400 1050" xml:space="preserve"
> preserveAspectRatio="xMidYMid meet" zoomAndPan="magnify"
> contentScriptType="text/ecmascript" contentStyleType="text/css" x="210"
> y="600" width="35" height="7.65354312" style="fill:white; stroke:black;
> stroke-width:1"/>
>         <text>
>              <tspan x="250" y="600">IJKL</tspan>
>         </text>
>         <rect id="MNOP" x="210" y="610" width="35" height="7.65354312"
> style="fill:lightgray; stroke:black; stroke-width:1"/>
>         <text>
>              <tspan x="255" y="610">MNOP</tspan>
>         </text>
>  </svg>
> 
> FIRST INPUT SVG DOCUMENT:
> -----------------------------------------------
> <?xml version="1.0" encoding="iso-8859-1"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102 Stylable//EN"
> "http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd";>
> <svg id="file1" viewBox="50 300 400 1050" xml:space="preserve">
> <rect id="ABCD" x="210" y="575" width="35" height="7.65354312"
> style="fill:white; stroke:black; stroke-width:1"/> <text><tspan x="250"
> y="578.82677156">ABCD</tspan></text>
> <rect id="EFGH" x="210" y="582.65354312" width="35" height="7.65354312"
> style="fill:lightgray; stroke:black; stroke-width:1"/> <text><tspan x="255"
> y="586.48031468">EFGH</tspan></text>
>  </svg>
> 
> SECOND INPUT SVG DOCUMENT:
> ---------------------------------------------------
> <?xml version="1.0" encoding="iso-8859-1"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102 Stylable//EN"
> "http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd";>
> <svg id="file2" viewBox="50 300 400 1050" xml:space="preserve">
> <rect id="IJKL" x="210" y="600" width="35" height="7.65354312"
> style="fill:white; stroke:black; stroke-width:1"/> <text><tspan x="250"
> y="600">IJKL</tspan></text>
> <rect id="MNOP" x="210" y="610" width="35" height="7.65354312"
> style="fill:lightgray; stroke:black; stroke-width:1"/> <text><tspan x="255"
> y="610">MNOP</tspan></text>
>  </svg>
> 
> STYLESHEET:
> ---------------------
> <?xml version="1.0" ?>
> 
> <xsl:stylesheet
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
>  xmlns:svg="http://www.w3.org/2000/svg";
>  xmlns="http://www.w3.org/2000/svg";>
> 
> <xsl:variable name="file1" select="document('file1.svg')/*"/>
> <xsl:variable name="file2" select="document('file2.svg')/*"/>
> 
> <xsl:output method="xml"  indent="yes" version="1.0" encoding="iso-8859-1"
> 
> 
> doctype-system="http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.d
> td"
>   doctype-public="-//W3C//DTD SVG 20001102 Stylable//EN"/>
> 
> <xsl:template match="/">
>   <svg viewBox="0 0 400 1050">
>       <xsl:call-template name="insertSVG">
>             <xsl:with-param name="source"   select="$file1"/>
>       </xsl:call-template>
>       <xsl:call-template name="insertSVG">
>             <xsl:with-param name="source"   select="$file2"/>
>       </xsl:call-template>
>   </svg>
> </xsl:template>
> 
> <xsl:template name="insertSVG">
>    <xsl:param name="source"/>
>    <xsl:apply-templates select="$source" mode="copy">
>    </xsl:apply-templates>
> </xsl:template>
> 
> <xsl:template match="*|@*|processing-instruction()|text()|/" mode="copy">
>    <xsl:choose>
>        <xsl:when test="local-name(.)='svg'">
>                 <xsl:apply-templates
>                         select="*|@*|processing-instruction()|text()"
> mode="copy">
>                 </xsl:apply-templates>
>       </xsl:when>
>           <xsl:otherwise>
>                  <xsl:copy>
>                 <xsl:apply-templates
>                         select="*|@*|processing-instruction()|text()"
> mode="copy">
>             </xsl:apply-templates>
>                  </xsl:copy>
>           </xsl:otherwise>
>    </xsl:choose>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
 <name firstName="Jirka" surname="Jirat"/>
 <mail>     jiratj@xxxxxxxxx  </mail>
 <support>  http://www.zvon.org </support>
 <zvonMailingList> http://www.zvon.org/index.php?nav_id=4
</zvonMailingList>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread