Re: [svg-developers] SVG internal script

2011-01-06 Thread ddailey
Take a look at 
http://www.w3.org/Graphics/SVG/IG/resources/svgprimer.html#joint_use -- there 
is an example there (look inside a table named Making SVG functions callable 
from HTML ).

Basically, suppose the svg is linked from the html via object, embed or 
iframe. And suppose the function within a script inside the svg is named 
happy(). Then, issue a command within the svg script that says top.happy=happy. 
This basically forces the html parent of the svg to alias the term happy to 
its definition within the svg script tag. Similar things may be done to 
access variables defined within svg script.

hope this helps
David
  - Original Message - 
  From: kalyan_ayyagari 
  To: svg-developers@yahoogroups.com 
  Sent: Wednesday, January 05, 2011 7:40 AM
  Subject: [svg-developers] SVG internal script



  Is there a way to access the internal script of a SVG file from a HTML where 
its embedded into?

  I have a SVG file which has some script in it...
  svg
  script type=text/ecmascript xlink:href=svgSample.js/
  

  If i try to access a function in this js file from a HTML file
  where this SVG is embedded, it shows
  'Uncaught ReferenceError: function is not defined'

  any thoughts??



  

[Non-text portions of this message have been removed]





-
To unsubscribe send a message to: svg-developers-unsubscr...@yahoogroups.com
-or-
visit http://groups.yahoo.com/group/svg-developers and click edit my 
membership
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)

* To change settings via email:
svg-developers-dig...@yahoogroups.com 
svg-developers-fullfeatu...@yahoogroups.com

* To unsubscribe from this group, send an email to:
svg-developers-unsubscr...@yahoogroups.com

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/



Re: [svg-developers] SVG internal script

2011-01-06 Thread Cameron Laird
On Thu, Jan 06, 2011 at 08:02:01AM -0500, ddailey wrote:
.
.
.
 Take a look at 
 http://www.w3.org/Graphics/SVG/IG/resources/svgprimer.html#joint_use -- there 
 is an example there (look inside a table named Making SVG functions callable 
 from HTML ).
 
 Basically, suppose the svg is linked from the html via object, embed 
 or iframe. And suppose the function within a script inside the svg is 
 named happy(). Then, issue a command within the svg script that says 
 top.happy=happy. This basically forces the html parent of the svg to alias 
 the term happy to its definition within the svg script tag. Similar 
 things may be done to access variables defined within svg script.
.
.
.
For a not-too-different technique in the vicinity of the original question,
see URL: http://www.ibm.com/developerworks/library/x-svgclientside/ .




-
To unsubscribe send a message to: svg-developers-unsubscr...@yahoogroups.com
-or-
visit http://groups.yahoo.com/group/svg-developers and click edit my 
membership
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)

* To change settings via email:
svg-developers-dig...@yahoogroups.com 
svg-developers-fullfeatu...@yahoogroups.com

* To unsubscribe from this group, send an email to:
svg-developers-unsubscr...@yahoogroups.com

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/



[svg-developers] Re: SVG internal script

2011-01-06 Thread kalyan_ayyagari

--- In svg-developers@yahoogroups.com, Cameron Laird cla...@... wrote:

 On Thu, Jan 06, 2011 at 08:02:01AM -0500, ddailey wrote:
   .
   .
   .
  Take a look at 
  http://www.w3.org/Graphics/SVG/IG/resources/svgprimer.html#joint_use -- 
  there is an example there (look inside a table named Making SVG functions 
  callable from HTML ).
  
  Basically, suppose the svg is linked from the html via object, 
  embed or iframe. And suppose the function within a script inside the 
  svg is named happy(). Then, issue a command within the svg script that 
  says top.happy=happy. This basically forces the html parent of the svg to 
  alias the term happy to its definition within the svg script tag. 
  Similar things may be done to access variables defined within svg script.
   .
   .
   .
 For a not-too-different technique in the vicinity of the original question,
 see URL: http://www.ibm.com/developerworks/library/x-svgclientside/ .

Guys , Thanks for the quick response!! it worked !!





-
To unsubscribe send a message to: svg-developers-unsubscr...@yahoogroups.com
-or-
visit http://groups.yahoo.com/group/svg-developers and click edit my 
membership
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)

* To change settings via email:
svg-developers-dig...@yahoogroups.com 
svg-developers-fullfeatu...@yahoogroups.com

* To unsubscribe from this group, send an email to:
svg-developers-unsubscr...@yahoogroups.com

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/



[svg-developers] Re: StyleSheet to Add missing Elements ID's

2011-01-06 Thread fi...@rocketmail.com
Thanks so much, That was very usefull.

Fisad.

--- In svg-developers@yahoogroups.com, t...@... t...@... wrote:

 Problem: It's pretty unlikely, but the stylesheet I sent could possibly 
 generate non-unique IDs because it doesn't check whether generate-id() 
 returns an ID that has already been created by appending underscores to an ID 
 that generate-id() returned for another node.  This version should fix it 
 (sorry about the missing indentation, the Yahoo Groups web interface mangles 
 it):
 
 
 ?xml version=1.0 ?
 stylesheet version=1.0 xmlns=http://www.w3.org/1999/XSL/Transform;
   key name=id match=*...@id] use=@id/
 
   template name=generateUniqueId
 param name=id select=generate-id()/
 param name=alreadyAddedIds/
 choose
   !-- Test whether $id is already taken by another item --
   when test=key('id',$id) or contains($alreadyAddedIds, concat(' 
 ',$id,' ')) 
 call-template name=generateUniqueId
   !-- Append something to the id until it's unique --
   with-param name=id select=concat($id,'_')/
   with-param name=alreadyAddedIds select=$alreadyAddedIds/
 /call-template
   /when
   otherwise
 value-of select=$id/
   /otherwise
 /choose
   /template
 
   template match=*
 param name=alreadyAddedIds select=' '/
 !-- Copy element and all attributes --
 copy
   for-each select=@*
 copy/
   /for-each
   choose
 !-- If id attribute is missing, generate one (only for svg elements) 
 --
 when test=not(@id) and 
 namespace-uri()='http://www.w3.org/2000/svg'
   variable name=id
 call-template name=generateUniqueId
   with-param name=alreadyAddedIds select=$alreadyAddedIds/
 /call-template
   /variable
   attribute name=id
 value-of select=$id/
   /attribute
   apply-templates
 with-param name=alreadyAddedIds 
 select=concat($alreadyAddedIds,$id,' ')/
   /apply-templates
 /when
 otherwise
   apply-templates
 with-param name=alreadyAddedIds select=$alreadyAddedIds/
   /apply-templates
 /otherwise
   /choose
 /copy
   /template
 
 /stylesheet
 
 
 
 --- In svg-developers@yahoogroups.com, th_w@ th_w@ wrote:
 
  Does this do the job for you?
  
  ?xml version=1.0 ?
  stylesheet version=1.0 xmlns=http://www.w3.org/1999/XSL/Transform;
key name=id match=*...@id] use=@id/
  
template name=generateUniqueId
  param name=id select=generate-id()/
  choose
!-- Test whether $id is already taken by another item --
when test=key('id',$id) 
  call-template name=generateUniqueId
!-- Append something to the id until it's unique --
with-param name=id select=concat($id,'_')/
  /call-template
/when
otherwise
  value-of select=$id/
/otherwise
  /choose
/template
  
template match=*
  !-- Copy element and all attributes --
  copy
for-each select=@*
  copy/
/for-each
!-- If id attribute is missing, generate one (only for svg elements) 
  --
if test=not(@id) and namespace-uri()='http://www.w3.org/2000/svg'
  attribute name=id
call-template name=generateUniqueId/
  /attribute
/if
  /copy
  apply-templates/
/template
  
  /stylesheet
  
  
  Thomas W.
  
  
  --- In svg-developers@yahoogroups.com, fisad@ fisad@ wrote:
  
   Is There any stylesheet to add missing id to elements in svg files.
   
   I have some svg files without id for some elements like path's and rect's 
   and I want to add the missing id's to this elements with the use of a 
   stylesheet.
   
   That is possible?.
   
   I can make that with a xml rutine in Delphi but that is to much long.
   
   Any idea?
   
   Thanks.
   
   Fisad.
  
 







-
To unsubscribe send a message to: svg-developers-unsubscr...@yahoogroups.com
-or-
visit http://groups.yahoo.com/group/svg-developers and click edit my 
membership
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)

* To change settings via email:
svg-developers-dig...@yahoogroups.com 
svg-developers-fullfeatu...@yahoogroups.com

* To unsubscribe from this group, send an email to:
svg-developers-unsubscr...@yahoogroups.com

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/