[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Merging multiple SVGs using XSLT

Subject: Merging multiple SVGs using XSLT
From: Yatin Kareer <yr_kareer@xxxxxxxxx>
Date: Fri, 7 Nov 2003 13:50:42 -0800 (PST)
svg xmlns
Hi Friends,
          This is my first mail to this
mailing-list... I am new to XSL, but quite amazed by
it's capabilities and power.
          I am trying to merge multiple SVG files into
a single composite SVG using XSLT. The scenario is
something like this:
          I have a main background SVG file, which has
a root node as the <svg id="backgrnd" width="200"
height="400"...etc..  </svg>... Onto this SVG I need
to add multiple smaller SVG files, however I cannot
add them as <image> tags due to some problems
downstream of the application. So, I am adding these
SVG images onto my background SVG by adding the new
SVG trees into the background SVG. So the final result
I seek is:
<svg id="backgrnd" width="200" height="400" etc..>
  <path...>
  <clip..>
  <g..>
  some more SVG tags for the background
  <svg id="img1" x="20" y="40" width="200"...>
    ..... Image on the background
  </svg>
  <svg id="img2" x="30" y="69" width="200"...>
    ..... another image on the background
  </svg>
    ...there can be n number of images like these

</svg>... finally the closure of the root of the
background SVG.

i.e. I am trying to add the img1 and img2 images
within the root of the background SVG tree... However
I notice that I am unable to add anything into the
root of the background SVG.. The result I get is
following: 
<svg id="backgrnd" width="200" height="400" etc..>
  <path...>
  <clip..>
  <g..>
  some more SVG tags on for the background
</svg>... finally the closure of the root of the
background SVG.
<svg id="img1" x="20" y="40" width="200"...>
    ..... Image on the background
  </svg>
  <svg id="img2" x="30" y="69" width="200"...>
    ..... another image on the background
  </svg>
    ...there can be n number of images like these

i.e. The images img1 and img2 get added as new nodes
at the same level as the root of the background SVG...

Following is the XSL code I am using...

<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="*[..]"/>
		<xsl:for-each select="/">

		
			
	        		<xsl:if test="position()=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">
		        	   	<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>

As you will notice, I am adding new SVG tags in the
above XSL to overcome my problem (and encapsulate
everything into the same top level <svg>), but this
causes some problems further in the application.

Being a novice, I apologize for any incorrect use of
terms like root node, or tree etc... 

I would appreciate any help with this matter...

Thank you,
Yatin Kareer.

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.