cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <jheini...@virbus.de>
Subject Re: AW: Using multiple resources in cocoon
Date Sat, 27 Sep 2003 13:37:12 GMT
Now you can simply compare the node sets:

<xsl:template match="user">
   <xsl:variable name="usertypes" select="userdata/usertypes/usertype"/>
   <xsl:variable name="services" 
select="document('service.rdf')/rdf:RDF/rdf:Description/serv:component"/>

   <xsl:value-of select="userdata/ID"/>
   <xsl:text>: </xsl:text>

   <xsl:apply-templates 
select="$services[rdf:Description/ut:usertypes/ut:usertype = $usertypes]"/>
</xsl:template>

<xsl:template match="serv:component">
   <xsl:value-of select="rdf:Description/@ID"/>
</xsl:template>

If you follow the suggestion of using aggregation (what I recommend 
especially because of one bug: 
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10203) you would 
simply replace the document() used above for $services with a simple 
XPath pointing to the services in the aggregated file.

Regards,

Joerg

Mustafa Ali, Halgurt wrote:

> Hi,
> 
> Ok I changed the structure of my documents, but I haven't still solved my problem and
I don't know a way to do it.
> 
> Thanks,
> Halgurt
> 
> -----Urspr√ľngliche Nachricht-----
> Von: Joerg Heinicke [mailto:jheinicke@virbus.de] 
> 
> Hello Halgurt,
> 
> it's obviously more an XSLT problem and so a bit off topic, but here is 
> my comment:
> 
> Your XML structures make it more difficult than necessary. Can you 
> change it? If you have
> 
> <ut:usertypes>
>    <ut:usertype>tourist</ut:usertype>
>    <ut:usertype>businessman</ut:usertype>
> </ut:usertypes>
> 
> in the one file and similarly
> 
> <usertypes>
>    <usertype>tourist</usertype>
>    <usertype>businessman</usertype>
> </usertypes>
> 
> in the other file it will be much easier, because you can simply compare 
> the node sets.
> 
> Joerg
> 
> 
> Mustafa Ali, Halgurt wrote:
> 
> 
>>Hi,
>>
>>I have maybe a stupid question; I am using an xml-file to generate some 
>>web application with cocoon, here is a part of my xml-file:
>>
>><?xml version="1.0"?>
>><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ut="http://description.org/schema/user-type"
xmlns:serv="http://description.org/schema/services">
>>  <rdf:Description ID="vcp-services" city="munich">
>>    <serv:component>
>>      <rdf:Description ID="museum">
>>        <rdf:type href="munich/cityinformation/museums"/>
>>        <ut:user>
>>          <rdf:tourist/>
>>        </ut:user>
>>        <rdf:image href="munich/images/stgeorg_ausgeschnitten.jpg"/>
>>        <ut:description>museums and galleries, Historical sights - technical
sights - history and art. A selection of museums and collections in Munich.</ut:description>
>>      </rdf:Description>
>>    </serv:component>
>>    <serv:component>
>>      <rdf:Description ID="hotels">
>>        <rdf:type href="munich/cityinformation/hotels"/>
>>        <ut:user>
>>          <rdf:tourist/>
>>          <rdf:businessman/>
>>        </ut:user>
>>        <ut:description>A list of munichs best Hotels.</ut:description>
>>      </rdf:Description>
>>    </serv:component>
>>    <serv:component>
>>      <rdf:Description ID="parking">
>>        <rdf:type href="munich/cityinformation/parking"/>
>>        <ut:user>
>>          <rdf:tourist/>
>>          <rdf:businessman/>
>>        </ut:user>
>>        <ut:description>Parking psobilities in and around munich.</ut:description>
>>      </rdf:Description>
>>    </serv:component>
>>  </rdf:Description>
>></rdf:RDF>
>>
>>and I have some user profiles, when I get a request, I am getting a 
>>request parameter with the ID of a single user after logging in, I saved 
>>the user profiles in files with there ID and an extension .xml as file 
>>names. Here is a sample user profile:
>>
>><? xml version="1.0" ?>
>>
>><user><userdata><ID>...</ID><usertype><tourist>yes</tourist><businessman>no</businessman>

>>........</userdata></user>
>>
>>now I want to use a stylesheet to generate my web application, and I 
>>want to generate just the parts of my xml-file, which are supposed to be 
>>for the user according to the values of usertype in the user profile, to 
>>do that I used document function, but as soon as I use this function on 
>>the user profile, all other roles, which are operation on my source file 
>>will be ignored and I get the whole content of the profile back, what am 
>>I doing wrong? Are there any possibilities to do that? Has somebody an 
>>idea how can I do that?
>>
>>It is really urgent; I am working since many days on this issue without 
>>any progression.
>>
>>Best regards,
>>
>>Halgurt


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message