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 [email protected], "fi...@..." <fi...@...> 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: [email protected]
-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:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/