private URI replaceHREF ( final QName attName , final Attributes atts ) { URI attValue = toURI ( atts . getValue ( attName . getNamespaceURI ( ) , attName . getLocalPart ( ) ) ) ; if ( attValue != null ) { final String fragment = attValue . getFragment ( ) ; if ( fragment != null ) { attValue = stripFragment ( attValue ) ; } if ( attValue . toString ( ) . length ( ) != 0 ) { final URI current = currentFile . resolve ( attValue ) ; final FileInfo f = job . getFileInfo ( current ) ; if ( f != null ) { final FileInfo cfi = job . getFileInfo ( currentFile ) ; final URI currrentFileTemp = job . tempDirURI . resolve ( cfi . uri ) ; final URI targetTemp = job . tempDirURI . resolve ( f . uri ) ; attValue = getRelativePath ( currrentFileTemp , targetTemp ) ; } else if ( tempFileNameScheme != null ) { final URI currrentFileTemp = job . tempDirURI . resolve ( tempFileNameScheme . generateTempFileName ( currentFile ) ) ; final URI targetTemp = job . tempDirURI . resolve ( tempFileNameScheme . generateTempFileName ( current ) ) ; final URI relativePath = getRelativePath ( currrentFileTemp , targetTemp ) ; attValue = relativePath ; } else { attValue = getRelativePath ( currentFile , current ) ; } } if ( fragment != null ) { attValue = setFragment ( attValue , fragment ) ; } } else { return null ; } return attValue ; }
Relativize absolute references if possible .