XLS transformation to add hyperlink



I'm new to XML and XSLT. What I'm trying to do is a XLS tranformation that matchesany element type album/name from my XML document and transforms their values into a link. What I've got so far does half of that. I'm stumped on how to get the links in. Any advice on how to accomplish this would be appreciated-


XML:



<music_inventory>
<album id="LEDZEP" type="full_length" albumart="http://ift.tt/1GEMAh5">
<artist>Led Zepplin</artist>
<name>Mothership</name>
<year>1968</year>
<label>Atlantic</label>
<disc>1</disc>
<totaldiscs>1</totaldiscs>
<tracklist>
<track id="1">Good Times Bad Times</track>
<track id="2">Communication Breakdown</track>
<track id="3">Dazed and Confused</track>
<track id="4">Babe I'm gonna Leave You</track>
<track id="5">Whole Lotta Love</track>
<track id="6">Ramble On</track>
<track id="7">Heartbreaker</track>
<track id="8">Immigrant Song</track>
<track id="9">Since I've Been Loving You</track>
<track id="10">Rock and Roll</track>
<track id="11">Black Dog</track>
<track id="12">When the Levee Breaks</track>
<track id="13">Stairway to Heaven</track>
</tracklist>
</album>
<album id="SUBL" type="full_length" albumart="http://ift.tt/1haNoBG">
<artist>Sublime</artist>
<name>Sublime</name>
<year>1996</year>
<label>MCA</label>
<disc>1</disc>
<totaldiscs>1</totaldiscs>
<tracklist>
<track id="1">Garden Grove</track>
<track id="2">What I Got</track>
<track id="3">Wrong Way</track>
<track id="4">Same in the End</track>
<track id="5">April 29, 1992 (Miami)</track>
<track id="6">Santeria</track>
<track id="7">Seed</track>
<track id="8">Jailhouse</track>
<track id="9">Pawn Shop</track>
<track id="10">Paddle Out</track>
<track id="11">The Ballad of Johnny Butt</track>
<track id="12">Burritos</track>
<track id="13">Under My Voodoo</track>
<track id="14">Get Ready</track>
<track id="15">Caress Me Down</track>
<track id="16">What I Got (Reprise)</track>
<track id="17">Doin' Time</track>
</tracklist>
</album>
</music_inventory>


XSL



<xsl:output method="xml" />

<xsl:template match="album/name">
<id>
<a xmlns="http://ift.tt/lH0Osb"
href="{../@id}.xhtml">
<xsl:value-of select="."/>
</a>
</id>
</xsl:template>

No comments:

Post a Comment