homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Gold Sponsor 2015!
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

Problem with XSL key generation

Msg#: 4318711 posted 5:30 pm on May 27, 2011 (gmt 0)

I have a problem with generating keys in XSL stylesheet.
First I post my code of XSL file:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:key name="distinct-author" match="author" use="."/>
<xsl:key name="distinct-date" match="logentry" use="substring-before(date, 'T')"/>
<xsl:template match="/">

<script type="text/javascript">

function selectNode(nodeid)
var divs = document.getElementsByClassName(nodeid);
for(var i=0; divs.length > i; i++) {




<h1>SVN Log</h1>
<xsl:for-each select="//author[generate-id()=generate-id(key('distinct-author',.)[1])]">
<xsl:variable name="forSelectArtist"><xsl:value-of select="."/></xsl:variable>
<option value="{$forSelectArtist}" onclick="selectNode(this.value)"><xsl:value-of select="."/></option>
<table border="1">
<tr bgcolor="#9acd32">

<xsl:for-each select="//logentry[generate-id()=generate-id(key('distinct-date', substring-before(date, 'T'))[1])]">
<xsl:sort select="date"/>
<xsl:variable name="currentArtist"><xsl:value-of select="author"/></xsl:variable>
<div class="{$currentArtist}" style="display:none;">

<xsl:for-each select="key('distinct-date', substring-before(date, 'T'))">

<xsl:if test="position() = 1">
<td valign="center">

<xsl:value-of select="substring-before(date, 'T')"/>


<xsl:value-of select="msg"/><br/>



My xml file is logfile generated from SVN system. example node looks like:

<logentry revision="27046">
<msg>[ LS + CP ] : Fixed bug concerning -&gt; added feature toggle for hotline calculator to deactivated OfferInfoBox in Production </msg>

Why is my xsl file is lost every second date, I probably have an error when creating the keys when I use substring-before function...

Help please!


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved