xsl-list
[Top] [All Lists]

Reassinging attribute values

2006-01-11 06:10:00
In the effort to deal with our ID values not being unique across a document, I 
am having to do some manipulation to the ID values to get my link anchors and 
targets matching up correctly. Many of our larger element types have what we 
call an eid on them which is just an ID like so:

<topic eid="1234">

Because I need to make all of these unique while I transform a document, I am 
pretty much tacking on information to the front of the ID. Then I would like to 
reassign the old eid= with my newly created value.

Here's what I was trying to do:

<xsl:template match="topic">
   <xsl:variable name="newId" select="string manipulation to get it how I want 
via checking xml:base, etc."/>
   <xsl:attribute name="eid">{$newId}</xsl:attribute>
</xsl:template>

Unfortunately, the Saxon parser doesn't allow the xsl:attribute to be there. I 
get an error saying SYNTAX WARNING::Cannot write an attribute node when no 
element start tag is open. After doing some reading it seems like the 
xsl:attribute and xsl:element tags only change these values in the output 
document which I assume is for when you want to do an XSL->XSL transformation. 
This isn't what I want so I guess I need to find an alternative way to reassign 
the eid attribute value.

If you saw my post yesterday title "Need assistance with match string", this 
all relates. In that post, I was massaging the eid used on the link anchor and 
in this one I am trying to massage in on the link target in hopes that they 
will both match and I can return the title of the topic. This output of this 
transform is actually FO and I am not having trouble with creating the link in 
FO (assigning the fo:block's id to my $newId and creating an fo:basic-link to 
that location and getting the correct fo:page-number-citation returned for my 
cross-reference) but I am unable to grab the title based on this massaged new 
eid value.

So basically I am looking for a way to change an attribute value in the tree 
while I am processing the document. Is there any way to do this?

Any suggestions would be greatly appreciated.

Thanks,
Cindy Hunt



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>