<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xlink="http://www.w3.org/1999/xlink"
	xmlns:lib="http://my.library/syntax/"
	xmlns="http://my.library/syntax/">

<xsl:template match="/lib:library">
	<xsl:copy>
		<xsl:apply-templates select="lib:book"/>
	</xsl:copy>
</xsl:template>

<xsl:template match="*[@xlink:href]">
	<xsl:copy-of select="id(substring-after(@xlink:href, '#'))"/>
</xsl:template>

<xsl:template match="*|@*">
	<xsl:copy>
		<xsl:apply-templates/>
	</xsl:copy>
</xsl:template>

</xsl:stylesheet>