RE: [xsl] Value Mapping

Subject: RE: [xsl] Value Mapping
From: omprakash.v@xxxxxxxxxxxxx
Date: Wed, 21 Jun 2006 10:31:14 +0530
Hi,
         I don't see what is it you want. You seem to have it already.
There's only a small error in your stylesheet which you can correct by
replacing

<xsl:template match="audience">
   <xsl:for-each select="audience/beneficiary[@scheme='GEM']">

with

<xsl:template match="audience">
   <xsl:for-each select="beneficiary[@scheme='GEM']">

Since you are already in the audience template and don't need
audience/beneficiary again. Similarly for toolfor as well. Also when you
check for equality like

    <xsl:when test=". = 'Teachers'">

you have to be wary of whitespace which might cause the test to fail. So
you should use

    <xsl:when test="normalize-space(.) = 'Teachers'"> or else use

    <xsl:when test="Contains(., 'Teachers')">.

Hope this helps.

cheers,
prakash








Regards,
V.Omprakash
Sr. Technical Architect,
Product Architecture group
4555 Intellect ct, Extn: 4547
Mobile: 98843 07767


                                                                                                                                
                      "oknam park"                                                                                              
                      <ponda7777@hotma         To:      xsl-list@xxxxxxxxxxxxxxxxxxxxxx                                         
                      il.com>                  cc:      (bcc: omprakash.v/Polaris)                                              
                                               Subject: RE: [xsl] Value Mapping                                                 
                      06/21/2006 01:35                                                                                          
                      AM                                                                                                        
                      Please respond                                                                                            
                      to xsl-list                                                                                               
                                                                                                                                
                                                                                                                                




I'm still waiting for your help.

Thanks a lot,

Best regards,
Oknam Park


>From: "oknam park" <ponda7777@xxxxxxxxxxx>
>Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>Subject: RE: [xsl] Value Mapping
>Date: Tue, 20 Jun 2006 07:43:54 +0000
>
>Sorry not for being clear.
>
>Here is my expectation.
>
>xml instance:
><audience>
>   <toolfor scheme="GEM">
>       Students
>   </toolfor>
>    <beneficiary scheme=GEM">Student Teachers </beneficiary>
>  </audience>
>
>My RDF transformation expectation is that beneficiary has a value from the

>scheme in GEM and it is "Student Teachers", xslt transformation to rdf is
><dcterms:beneficiary
>rdf:resource="http://purl.oclc.org/gem/instance/GEM-BEN/#StudentTeachers
"/>
>and if toolfor has a value from the scheme in GEM and it is "Teachers",
>xslt transformation to rdf is
><dcterms:beneficiary
>rdf:resource="http://purl.oclc.org/gem/instance/GEM-MED/#Teachers"; />
>
>Here is My xslt:
><xsl:template match="audience">
>   <xsl:for-each select="audience/beneficiary[@scheme='GEM']">
>       <xsl:choose>
>             <xsl:when test=". = 'Students'">
>                   <dcterms: beneficiary
>rdf:resource="http://purl.oclc.org/gem/instance/GEM-BEN/#StudentTeachers
"/>
>            </xsl:when>
>       </xsl:choose>
></xsl:for-each>
><xsl:for-each select="audience/toolfor[@scheme='GEM']">
>       <xsl:choose>
>             <xsl:when test=". = 'Teachers'">
>                   <dcterms: beneficiary
>rdf:resource="http://purl.oclc.org/gem/instance/GEM-MED/#Teachers"/>
>            </xsl:when>
>       </xsl:choose>
></xsl:for-each>
>
>  </xsl:template>
>
>Could you give me some help?
>
>Thanks a lot,
>
>Best regards,
>Oknam Park
>
>
>>From: "Michael Kay" <mike@xxxxxxxxxxxx>
>>Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>>To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
>>Subject: RE: [xsl] Value Mapping
>>Date: Tue, 20 Jun 2006 08:18:27 +0100
>>
>>It's difficult to help you when we don't know what output you want. Your
>>code is obviously wrong (the source has "toolfor" where your code has
>>"beneficiary"; also the template has "audience" as the context node, and
>>then tries to find a child called "audience", which doesn't exist in your
>>source sample). But without knowing what you want to achieve, I can't
>>correct it for you.
>>
>>Michael Kay
>>http://www.saxonica.com/
>>
>> >
>> > I need value mapping when a value in the subelement is
>> > matched with some value string.
>> >
>> > xml instance:
>> > <audience>
>> > <toolfor scheme="GEM">
>> >    Students
>> > </toolfor>
>       <beneficiary scheme=GEM">Students </beneficiary></audience>
>
>> >
>> > My xslt:
>> > <xsl:template match="audience">
>> > <xsl:for-each select="audience/beneficiary[@scheme='GEM']">
>> >     <xsl:choose>
>> >        <xsl:when test=". = 'Students'"><gemq:beneficiary
>> > rdf:resource="http://purl.oclc.org/gem/instance/GEM-BEN/#Stude
>> > nts"/></xsl:when>
>> >     </xsl:choose>
>> > </xsl:for-each>  </xsl:template>
>> >
>> > Could you give me some help?



This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only.  If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit us at http://www.polaris.co.in

Current Thread