xsl-list
[Top] [All Lists]

RE: Merging multiple SVGs using XSLT

2003-11-07 16:09:51

Following is the XSL code I am using...

I can't tell you what you should be doing (it's too late at night to try
and understand your problem clearly) but I can tell you a little about
what you're doing wrong.

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>



      <xsl:template match="/">
              <svg xmlns="http://www.w3.org/2000/svg";
xmlns:svg="http://www.w3c.org/2000/svg"; width="1656" 
height="2088" viewBox="0 0 1656 2088"> 

    <xsl:copy-of select="*[..]"/>

This xsl:copy-of instruction copies all children of the root node that
have a parent. Of course all children of the root have a parent, so the
predicate does nothing. If you left out the predicate, you would copy
the whole source document, without making any changes to it. That can't
really be what you want.

              <xsl:for-each select="/">

This selects the root node of the tree and iterates over it. There's no
point in iterating over a node-set containing a single node (and it's
only selecting the node that's already the context node for this
template anyway).

              
                      
                              <xsl:if test="position()=last()">

If you're iterating over one node, then that node will always be the
last...

                                      <svg 
xmlns="http://www.w3.org/2000/svg";
xmlns:svg="http://www.w3c.org/2000/svg"; x="456"
y="420" width="748" height="224">

Both these namespaces are already declared, why do you need to declare
them again?

                                      <xsl:copy-of 
select="document('http://10.96.10.20/servlet/ImageReaderByNIDQ
?nacid=119476&amp;filetype=f')"/>
                                      </svg>

                                      <svg 
xmlns="http://www.w3.org/2000/svg";
xmlns:svg="http://www.w3c.org/2000/svg"; x="396"
y="756" width="864" height="540">
                                      <xsl:copy-of 
select="document('http://10.96.10.20/servlet/ImageReaderByNIDQ
?nacid=119480&amp;filetype=f')"/>
                                      </svg>
                              </xsl:if>
                      
              
              </xsl:for-each>
              </svg>
      </xsl:template> 
      
      
</xsl:stylesheet>


I'm sorry my comments aren't more constructive but I hope they help you
see what you're doing wrong.

Michael Kay


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



<Prev in Thread] Current Thread [Next in Thread>