template uri and setting element IDs on generated elements

classic Classic list List threaded Threaded
2 messages Options
rvj
Reply | Threaded
Open this post in threaded view
|

template uri and setting element IDs on generated elements

rvj
Once upon a time I probably knew the answer to the following .....


 given that I can create a template with specifies the element  ID

       <template>
          <element   uri="..."   id="identity" />
        </template>


is it possible to pass the id as a varaiable

     <template>
          <element   uri="..."
id="rdf:http://www.rolemodels.co.uk/rdf#identity" />
        </template>


1. the problem with the first is that it generate generate a series of
elements with the same element ID

2. the problem with the second is that it doesnt seem to set the ID
attribute as hoped for


is there a workaround such as using the approach such as  using the first
approach and then change the ID using DOM methods

    // grab all generated elements
      elements=document.getElementsByTagName('element')

    // iterate through elements assigning new attributes
    for (i=0;i<elements.length;i++)
    {
            elements[i]. .....      // change the element id

    }


or is there an easier way to do this?

<ns1:element about="urn:0"  ns:identity="identity1"    />
<ns1:element about="urn:1"  ns:identity="identity2"    />












_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf
Reply | Threaded
Open this post in threaded view
|

Re: template uri and setting element IDs on generated elements

Neil-4
rvj wrote:

>given that I can create a template with specifies the element  ID
>
>       <template>
>          <element   uri="..."   id="identity" />
>        </template>
>  
>
No you can't; ids identify the elements in the template, and are not
applied to generated content, except in the case of uri="..." or
uri="rdf:*" in which case an id is generated as the child RDF resource's
value.

--
Warning: May contain traces of nuts.
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf