IDREFs2bareNames.xslt

This little XSLT 1.0 stylesheet turns the values of IDREF and IDREFS attributes into bare name fragment identifiers, i.e. URI pointers into the base document.

Known bugs: we just presume that the base document (as defined by the xml:base= attribute) is the current document. If it's not, you'll probably end up with valid pointers that point nowhere. :-(

 



<xsl:template match="     */@grpPtr             | gram/@location        | div7/@decls    | */@depPtr             | gram/@mergedin        | front/@decls    | */@corresp            | gen/@location         | back/@decls    | */@synch              | gen/@mergedin         | link/@targets    | */@sameAs             | number/@location      | linkGrp/@domains    | */@copyOf             | number/@mergedin      | when/@since    | */@next               | case/@location        | timeline/@origin    | */@prev               | case/@mergedin        | join/@targets    | */@exclude            | per/@location         | joinGrp/@domains    | */@select             | per/@mergedin         | alt/@targets    | */@ana                | tns/@location         | altGrp/@domains    | tagUsage/@render      | tns/@mergedin         | span/@inst    | keywords/@scheme      | mood/@location        | span/@from    | classCode/@scheme     | mood/@mergedin        | span/@to | catRef/@target       | itype/@location       | spanGrp/@inst | catRef/@scheme       | itype/@mergedin       | interp/@inst | gloss/@target        | gramGrp/@location     | interpGrp/@inst | abbr/@resp           | gramGrp/@mergedin     | fs/@feats | expan/@resp          | pos/@location         | f/@fVal | gap/@resp            | pos/@mergedin         | certainty/@target | gap/@hand            | subc/@location        | respons/@target | add/@resp            | subc/@mergedin        | addSpan/@resp | add/@hand            | colloc/@location      | addSpan/@hand | del/@resp            | colloc/@mergedin      | addSpan/@to | del/@hand            | def/@location         | delSpan/@resp | unclear/@hand        | def/@mergedin         | delSpan/@hand | ptr/@target          | trans/@location       | delSpan/@to | ref/@target          | trans/@mergedin       | restore/@resp | note/@target         | tr/@location          | restore/@hand | note/@targetEnd      | tr/@mergedin          | supplied/@hand | sp/@who              | etym/@location        | handShift/@new | move/@who            | etym/@mergedin        | handShift/@old | move/@perf           | lang/@location        | handShift/@resp | tech/@perf           | lang/@mergedin        | damage/@resp | u/@start             | eg/@location          | damage/@hand | u/@end               | eg/@mergedin          | app/@from | u/@decls             | usg/@location         | app/@to | u/@who               | usg/@mergedin         | lem/@hand | pause/@start         | lbl/@location         | rdg/@hand | pause/@end           | lbl/@mergedin         | rdgGrp/@hand | pause/@who           | xr/@location          | witDetail/@target | vocal/@start         | xr/@mergedin          | node/@value | vocal/@end           | re/@location          | node/@adjTo | vocal/@who           | re/@mergedin          | node/@adjFrom | kinesic/@start       | oRef/@target          | node/@adj | kinesic/@end         | oRef/@location        | arc/@from | kinesic/@who         | oRef/@mergedin        | arc/@to | event/@start         | oVar/@target          | root/@value | event/@end           | oVar/@location        | root/@children | event/@who           | oVar/@mergedin        | iNode/@value | writing/@who         | pRef/@target          | iNode/@children | writing/@script      | pRef/@location        | iNode/@parent | shift/@who           | pRef/@mergedin        | iNode/@follow | entryFree/@location  | pVar/@target          | leaf/@value | entryFree/@mergedin  | pVar/@location        | leaf/@parent | hom/@location        | pVar/@mergedin        | leaf/@follow | hom/@mergedin        | gram/@location        | eTree/@value | sense/@location      | gram/@mergedin        | triangle/@value | sense/@mergedin      | text/@decls           | eLeaf/@value | form/@location       | body/@decls           | occupation/@scheme | form/@mergedin       | group/@decls          | occupation/@code | orth/@location       | div/@decls            | socecStatus/@scheme | orth/@mergedin       | div0/@decls           | socecStatus/@code | pron/@location       | div1/@decls           | relation/@active | pron/@mergedin       | div2/@decls           | relation/@passive | hyph/@location       | div3/@decls           | setting/@who | hyph/@mergedin       | div4/@decls | syll/@location       | div5/@decls | syll/@mergedin       | div6/@decls ">                                               

  #  <xsl:when test="not(contains($value,' '))"> <xsl:value-of select="$value"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="substring-before($value,' ')"/>  </xsl:text>  <xsl:with-param name="value"> <xsl:value-of select="substring-after($value,' ')"/> </xsl:with-param> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template>

</xsl:stylesheet>