Home › Forums › DITA and XMetaL Discussion › Modify xref target on save? › Reply To: Modify xref target on save?
Reply to: Modify xref target on save?
December 23, 2008 at 5:35 pmThanks for assist, David. Since there are a couple of ways a user can insert an xref, I decided to check them all at validation time instead, and modify the the href if needed. Here is what I came up with, which seems to work on all my tests so far:
[pre]
for (var i = 0; i < xrefs.length; ++i) {
var href = xrefs.item(i).nodeValue;
var split = href.indexOf(“#”)
var fname = href.substr(0, split);
if (fname == ActiveDocument.name) {
xrefs.item(i).nodeValue = href.substr(split);
}
}
]]>