Connecting Tech Pros Worldwide Help | Site Map

Question about possibilities of XSLT / generate unique ID and reuse it

Daniel Hilgarth
Guest
 
Posts: n/a
#1: Nov 24 '06
Hello,

I am currently trying to use XSLT for the creation of multiple
HTML-files from a single XML-File.
This HTML-files need to have links to each other.
The following information might be important:
There are some special nodes that will start a new HTML-page
("page-nodes"). Those nodes can be nested.
Those nodes have an attribute "name" which is not necessarily unique.
There are another special nodes that will create a link in one HTML-Page
to another. Those nodes uses the values of the "name"-attribute to
distinguish the special node that is referenced.
Now my problems: I could create unique numbers in the page-nodes with
xsl:number. But I am not able to find out that number again later in a
different template. The problem is not, that I don't know which node is
referenced, but the problem is that I am simply not able to get that
number via xsl:number, because of the way this tag works.

Any hints and ideas are very welcome.

Kind regards,
Daniel Hilgarth

*** Sent via Developersdex http://www.developersdex.com ***
Martin Honnen
Guest
 
Posts: n/a
#2: Nov 25 '06

re: Question about possibilities of XSLT / generate unique ID and reuse it


Daniel Hilgarth wrote:
Quote:
I am currently trying to use XSLT for the creation of multiple
HTML-files from a single XML-File.
This HTML-files need to have links to each other.
The following information might be important:
There are some special nodes that will start a new HTML-page
("page-nodes"). Those nodes can be nested.
Those nodes have an attribute "name" which is not necessarily unique.
There are another special nodes that will create a link in one HTML-Page
to another. Those nodes uses the values of the "name"-attribute to
distinguish the special node that is referenced.
Now my problems: I could create unique numbers in the page-nodes with
xsl:number. But I am not able to find out that number again later in a
different template.
If you want a unique id, have you tried the generate-id function
<http://www.w3.org/TR/xslt#function-generate-id>
that XSLT provides? That way you can generate an id from a node and it
is unique. You just need to make sure you pass the same node to the
function when you need the id for a second time.


--

Martin Honnen
http://JavaScript.FAQTs.com/
Closed Thread