XML Elves

XML Elves

<community>of XML and SVG Developers</community>


URI references

This is a discussion on URI references within the SVG Questions forums, part of the SVG Forums category; Hello, I'm trying to reference an element from another file. I made two files, a collection which will contain all ...


Go Back   XML Elves > SVG Forums > SVG Questions

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Notices


Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-29-2004, 04:25 AM
a SVG newbie!
Guest
 
Posts: n/a
Default URI references

Hello,
I'm trying to reference an element from another file. I made two files, a collection which will contain all elements and another file that reference theses elements:

collection:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE svg SYSTEM "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<g id="input">
<path d="M 13 26 h 50 l -12 -12 12 -12 h -50 Z">
</g>

use file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE svg SYSTEM "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="800" height="600">
<use x="100" y="100" xlink:href="collection.svg#input"/>
</svg>

Is it the right way to do that?
This doesn't work on my computer. I got IE6 and Adobe SVG viewer 3
It works when the group and the use are in the same file...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-29-2004, 04:38 AM
Guest
Guest
 
Posts: n/a
Default a SVG newbie!

I've had a similar problem, but i found on the net a couple of files which dealt with the same problem..
just make paste the contents into 3 separate files called example.html, controls.svg, svg1.svg

-------------------in EXAMPLE.html-------------------------------------------------------:

<html>
<head>
<title>Example of panning SVG</title>
</head>
<body>

<SCRIPT language=javascript>
var htmldocument=document
</SCRIPT>
<p>

<embed width="400" height="400" src="svg1.svg" style="float: left" align="left" name="ball">
<embed width="200" height="100" src="controls.svg" name="kontroll">
</p>
</body>
</html>


-------------------in CONTROLS.SVG:-------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1" standalone='no'?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN"
"http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">
<svg width='200' height='150' onload='init(evt)'>

<script><![CDATA[
var svgdoc='',root='';

function init(evt)
{
svgdoc=htmldocument.embeds[0].getSVGDocument();
root=svgdoc.firstChild();
}

function zoom(k)
{
svgdoc=htmldocument.embeds["kontroll"].getSVGDocument();
root=svgdoc.firstChild();
var old_value=root.currentScale;
new_value=old_value * k;
root.currentScale=new_value;
}

function pan(k1,k2)
{
svgdoc=htmldocument.embeds[0].getSVGDocument();
root=svgdoc.firstChild();
var old_value=root.currentScale;
if (k1!=0)
{
old_x=root.currentTranslate.x;
x=old_x + k1 * 20;
root.currentTranslate.x=x;
}
else
{
old_y=root.currentTranslate.y;
y=old_y + k2 * 20;
root.currentTranslate.y=y;
}
}

function reset()
{
svgdoc=htmldocument.embeds[0].getSVGDocument();
root=svgdoc.firstChild();
root.currentTranslate.x=0;
root.currentTranslate.y=0;
root.currentScale=1;
}

]]></script>

<text x='10' y='15' style='font-size:15'>Zoom:</text>
<text onclick='zoom(2)' x='55' y='15'>In</text>
<text onclick='zoom(0.5)' x='70' y='15'>Out</text>
<text x='10' y='35' style='font-size:15'>Pan:</text>
<text onclick='pan(-1,0)' x='47' y='35'>Left</text>
<text onclick='pan(0,-1)' x='70' y='35'>Up</text>
<text onclick='pan(0,1)' x='90' y='35'>Down</text>
<text onclick='pan(1,0)' x='124' y='35'>Right</text>
<text onclick='reset()' x='10' y='55' style='font-size:15'>Reset</text>
</svg>


----------------------------in SVG1.svg:-----------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1" standalone='no'?>


<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN"
"http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">


<svg id="svg1" width='400' height='400' viewBox="00 0 400 400">
<circle style="fill:green;stroke:green;" cx="200" cy="200" r="100"/>

</svg>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-30-2004, 09:25 AM
Anonymous
Guest
 
Posts: n/a
Default URI references

hi there is one little error you should put svg tags around the content in collection.

collection:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE svg SYSTEM "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg>
<g id="input">
<path d="M 13 26 h 50 l -12 -12 12 -12 h -50 Z">
</g>
</svg>

it will still not work in ASV3 but will do fine in ASV6.
hth
holger
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11-08-2004, 01:27 AM
Anonymous
Guest
 
Posts: n/a
Default Re: a SVG newbie!

Quote:
Originally Posted by Guest
I've had a similar problem, but i found on the net a couple of files which dealt with the same problem..
just make paste the contents into 3 separate files called example.html, controls.svg, svg1.svg

-------------------in EXAMPLE.html-------------------------------------------------------:

<html>
<head>
<title>Example of panning SVG</title>
</head>
<body>

<SCRIPT language=javascript>
var htmldocument=document
</SCRIPT>
<p>

<embed width="400" height="400" src="svg1.svg" style="float: left" align="left" name="ball">
<embed width="200" height="100" src="controls.svg" name="kontroll">
</p>
</body>
</html>


-------------------in CONTROLS.SVG:-------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1" standalone='no'?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN"
"http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">
<svg width='200' height='150' onload='init(evt)'>

<script><![CDATA[
var svgdoc='',root='';

function init(evt)
{
svgdoc=htmldocument.embeds[0].getSVGDocument();
root=svgdoc.firstChild();
}

function zoom(k)
{
svgdoc=htmldocument.embeds["kontroll"].getSVGDocument();
root=svgdoc.firstChild();
var old_value=root.currentScale;
new_value=old_value * k;
root.currentScale=new_value;
}

function pan(k1,k2)
{
svgdoc=htmldocument.embeds[0].getSVGDocument();
root=svgdoc.firstChild();
var old_value=root.currentScale;
if (k1!=0)
{
old_x=root.currentTranslate.x;
x=old_x + k1 * 20;
root.currentTranslate.x=x;
}
else
{
old_y=root.currentTranslate.y;
y=old_y + k2 * 20;
root.currentTranslate.y=y;
}
}

function reset()
{
svgdoc=htmldocument.embeds[0].getSVGDocument();
root=svgdoc.firstChild();
root.currentTranslate.x=0;
root.currentTranslate.y=0;
root.currentScale=1;
}

]]></script>

<text x='10' y='15' style='font-size:15'>Zoom:</text>
<text onclick='zoom(2)' x='55' y='15'>In</text>
<text onclick='zoom(0.5)' x='70' y='15'>Out</text>
<text x='10' y='35' style='font-size:15'>Pan:</text>
<text onclick='pan(-1,0)' x='47' y='35'>Left</text>
<text onclick='pan(0,-1)' x='70' y='35'>Up</text>
<text onclick='pan(0,1)' x='90' y='35'>Down</text>
<text onclick='pan(1,0)' x='124' y='35'>Right</text>
<text onclick='reset()' x='10' y='55' style='font-size:15'>Reset</text>
</svg>


----------------------------in SVG1.svg:-----------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1" standalone='no'?>


<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN"
"http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">


<svg id="svg1" width='400' height='400' viewBox="00 0 400 400">
<circle style="fill:green;stroke:green;" cx="200" cy="200" r="100"/>

</svg>
8) :P :twisted: [size=18px][/size]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
references, uri


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -6. The time now is 07:41 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0

Printer Ink Cartridge
Buy your printer ink cartridge from this online company and save.

hard disk drive repair recovery manchester
Data Clinic's hard disk drive data recovery and repair success lead to satisfied customers. We are easy to find in Manchester.

ink cartridges Free UK Delivery on ink cartridges such as Canon, Dell, Epson, hp & Lexmark.

1 2 3 4 5 6 7 8 9 10