Subject: Re: [xsl] Help with recursion (was: my brain is hurting) From: "Joris Gillis" <roac@xxxxxxxxxx> Date: Sat, 15 Jan 2005 12:16:09 +0100 |
the 'useparent' attribute specifies if that user or group should inherit its settings from its parent (1), or if it should specify its own (0). I am trying to get a list of users per group who should use the settings defined by that group.I'm not quite sure what yis the purpose of this parameter.
I iterate over each group name, and run the transform with <param name='group'/>, passing in each group name in turn.
In the above case, user 'phil' is not inheriting setting from the parent, and as such wont appear in the list for any group.
User 'chris' is inheriting from group 'othergroup', which is in turn inheriting from group 'default'. So, the user list for group 'default' should contain the user 'chris'.
The user list list for group 'othergroup' should be empty, as it has no settings of its own.
<root> <settings> <user name="chris"> <module useparent="1" > ...empty... </module> </user> <user name="phil"> <module useparent="0" > ...module settings... </module> </user> <group name="default"> <module useparent="0" > ...module settings... </module> </group> <group name="othergroup"> <module useparent="1" > ...empty... </module> </group> </settings>
<users> <user name="chris" parent="othergroup"> ... </user> <user name="phil" parent="othergroup"> ... </user> <group name="default" parent=""> ... </group> <group name="othergroup" parent="default"> ... </group> </users> </root>
,the following stylesheet: <?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" indent="yes"/>
<xsl:template match="root"> <xsl:apply-templates select="settings/group" mode="settings"/> </xsl:template>
<xsl:template match="user" mode="users"> <xsl:if test="count(key('settingUser',@name))=1"> <li><xsl:value-of select="@name"/></li> </xsl:if> </xsl:template>
<h1>Group: default</h1> <ul> <li>chris</li> </ul> <h1>Group: othergroup</h1> <ul></ul>
regards, -- Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041) Deserta faciunt et innovationem appelant
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Help with recursion (was: my , Chris Picton | Thread | Re: [xsl] My brain is hurting, António Mota |
[xsl] Use of fictitious types in th, Dimitre Novatchev | Date | RE: [xsl] Complex XPath Expression, Michael Kay |
Month |