B
Ben
Hello!
im having a very annoying problem with XSLT
at the moment i have an xml with xslt, it displays the data as such:
C:\Test
- C:\Test\New Elf
- C:\Test\New Folder
C:\Te
- C:\Te\New Elf
- C:\Te\New Folder
C:\Te\New Elf
- C:\Te\New Elf\test2
the problem is the last element 'C:\Te\New Elf', it doesnt recognise
it's a sub element of C:\Te\, the current way i format the xml is
<UsersPermissions>
<userPermissions>
<user>WW00</user>
<rights>Read</rights>
<location>C:\Test</location>
</userPermissions>
<userPermissions>
<user>WW00</user>
<rights>Read</rights>
<location>C:\Test</location>
</userPermissions>
<userPermissions>
<user>WW0</user>
<rights>Read</rights>
<parent>C:\Test</parent>
<location>C:\Test\New Folder</location>
</userPermissions>
<userPermissions>
<user>WW0</user>
<rights>Read</rights>
<parent>C:\Test</parent>
<location>C:\Test\New Elf</location>
</userPermissions>
<userPermissions>
<user>WW00</user>
<rights>Read</rights>
<location>C:\Te</location>
</userPermissions>
<userPermissions>
<user>WW004\gb7senk1</user>
<rights>Read</rights>
<parent>C:\Te\New Elf</parent>
<location>C:\Te\New Elf\test2</location>
</userPermissions>
and the XSLT is formatted thusly
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:key name="path" match="UsersPermissions/userPermissions"
use="parent"/>
<xsl:template match="/">
<html>
<head>
<script type="text/javascript" src="listCollapse.js"></script>
<style type="text/css">
ul.maketree, ul.maketree ul, ul.maketree li {
margin: 0;
padding: 0;
list-style-type: none;
}
ul.maketree ul { padding-left: 0.3em; }
ul.maketree li {
border-left: 1px dotted #000;
padding-left: 13px;
background: url(dotted.gif) scroll no-repeat 1px 0.8em;
}
ul.maketree li.last {
border-left-width: 0px;
padding-left: 14px;
background: url(dottedangle.gif) scroll no-repeat left top;
}
</style>
</head>
<body>
<script type="text/javascript">
window.onload = function () {
compactMenu('test1',false,'+ ');
selfLink('test1','selfhighlight',true);
}
</script>
<ul class="maketree" id="test1">
<xsl:for-each select="//userPermissions[generate-id(.)=
generate-id(key('path',parent)[1])]">
<li><xsl:if test="//userPermissions[location=current()/
parent]">
<xsl:value-of select="parent"/>
</xsl:if>
<ul>
<xsl:for-each select="//userPermissions[parent=current()/
parent]">
<xsl:sort select="location"/>
<li>
<xsl:value-of select="location"/>
</li>
</xsl:for-each>
</ul>
</li>
</xsl:for-each>
</ul>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Does anyone please know of a way to get thingy to understand the sub
elements are subelements?
if you compile the code you should see the problem
Thank you soo much in advance, this is driving me mad
Ben
im having a very annoying problem with XSLT
at the moment i have an xml with xslt, it displays the data as such:
C:\Test
- C:\Test\New Elf
- C:\Test\New Folder
C:\Te
- C:\Te\New Elf
- C:\Te\New Folder
C:\Te\New Elf
- C:\Te\New Elf\test2
the problem is the last element 'C:\Te\New Elf', it doesnt recognise
it's a sub element of C:\Te\, the current way i format the xml is
<UsersPermissions>
<userPermissions>
<user>WW00</user>
<rights>Read</rights>
<location>C:\Test</location>
</userPermissions>
<userPermissions>
<user>WW00</user>
<rights>Read</rights>
<location>C:\Test</location>
</userPermissions>
<userPermissions>
<user>WW0</user>
<rights>Read</rights>
<parent>C:\Test</parent>
<location>C:\Test\New Folder</location>
</userPermissions>
<userPermissions>
<user>WW0</user>
<rights>Read</rights>
<parent>C:\Test</parent>
<location>C:\Test\New Elf</location>
</userPermissions>
<userPermissions>
<user>WW00</user>
<rights>Read</rights>
<location>C:\Te</location>
</userPermissions>
<userPermissions>
<user>WW004\gb7senk1</user>
<rights>Read</rights>
<parent>C:\Te\New Elf</parent>
<location>C:\Te\New Elf\test2</location>
</userPermissions>
and the XSLT is formatted thusly
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:key name="path" match="UsersPermissions/userPermissions"
use="parent"/>
<xsl:template match="/">
<html>
<head>
<script type="text/javascript" src="listCollapse.js"></script>
<style type="text/css">
ul.maketree, ul.maketree ul, ul.maketree li {
margin: 0;
padding: 0;
list-style-type: none;
}
ul.maketree ul { padding-left: 0.3em; }
ul.maketree li {
border-left: 1px dotted #000;
padding-left: 13px;
background: url(dotted.gif) scroll no-repeat 1px 0.8em;
}
ul.maketree li.last {
border-left-width: 0px;
padding-left: 14px;
background: url(dottedangle.gif) scroll no-repeat left top;
}
</style>
</head>
<body>
<script type="text/javascript">
window.onload = function () {
compactMenu('test1',false,'+ ');
selfLink('test1','selfhighlight',true);
}
</script>
<ul class="maketree" id="test1">
<xsl:for-each select="//userPermissions[generate-id(.)=
generate-id(key('path',parent)[1])]">
<li><xsl:if test="//userPermissions[location=current()/
parent]">
<xsl:value-of select="parent"/>
</xsl:if>
<ul>
<xsl:for-each select="//userPermissions[parent=current()/
parent]">
<xsl:sort select="location"/>
<li>
<xsl:value-of select="location"/>
</li>
</xsl:for-each>
</ul>
</li>
</xsl:for-each>
</ul>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Does anyone please know of a way to get thingy to understand the sub
elements are subelements?
if you compile the code you should see the problem
Thank you soo much in advance, this is driving me mad
Ben