[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: hyperlink
Hi Paul, > I have an xml file linked to an xsl sheet and a schema. I'm having > trouble linking a column of table data. The column contains project > titles which, I would like to link to their respective descriptions. > The table has multiple headers which, when clicked, sort the > corresponding column of data. I can't figure out how to make a > different link for each piece of data in the "project title" column. > I'm hoping I don't have to use xlink, as I am barely figuring out > xsl hehe. The following is the section of the xsl sheet I am > referring to, then the xml file. Thank you for any help. As I understand it, the bit you're having problems with is in trying to create a link from the table, which contains the names of the projects, to a description about each project. You don't say where this description resides - perhaps you want a pop-up box, perhaps it's further down the page, perhaps it has its own page? I'll assume that it's further down the same page for now. In any case, to do it you need a unique ID for each project that you can use as the anchor for the project description, which you then link to. There are several things that you could use for the unique ID for the project: * the project title, normalized and with spaces replaced by hyphens or underscores translate(normalize-space(project_title), ' ', '_') * the position of the project in the list, prefixed by some letters to create a valid ID concat('proj', count(preceding-sibling::project)) * a generated ID for the project using generate-id() generate-id() These each have advantages and disadvantages. The first two will stay the same every time you perform the transformation, whereas the generated ID might change. The project titles may not be unique - that's something you have to check in your source - and are fairly long. The position of the project takes a long time to calculate. Taking the last option, you need to create a link that uses this ID within the table cell holding the project title: <td> <div class="row"> <a href="#{generate-id()}"> <xsl:value-of select="project_title" /> </a> </div> </td> and create an anchor for the project when you give its description further down the page, which probably looks something like: <xsl:template match="project"> <h2> <a name="{generate-id()}" id="{generate-id()}"> <xsl:value-of select="project_title" /> </a> </h2> <xsl:apply-templates select="description" /> </xsl:template> I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|