How to use refereneces in xsl

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use refereneces in xsl

Nathan Maves
I have cyclical objects that print out the xml using xpath.  How do I  
actually use this in xsl transformations?


example...

<people>
        <person>
                <name>Fred</name>
        </person>
        <person>
                <name>Joe</name>
        </person>
        <person reference="../person[0]"/>
</people>

below does not work for me.....

   <xsl:template match="people">
     <xsl:for-each select="peson">
         <xsl:value-of select="name"/>
     </xsl:for-each>
   </xsl:template>

Nathan
Reply | Threaded
Open this post in threaded view
|

Re: How to use refereneces in xsl

Nathan Maves
Anyone had a chance to look at this?  I am really stuck and not sure  
where else to go?

Nathan

On Jan 6, 2006, at 11:26 AM, Nathan Maves wrote:

> I have cyclical objects that print out the xml using xpath.  How do  
> I actually use this in xsl transformations?
>
>
> example...
>
> <people>
> <person>
> <name>Fred</name>
> </person>
> <person>
> <name>Joe</name>
> </person>
> <person reference="../person[0]"/>
> </people>
>
> below does not work for me.....
>
>   <xsl:template match="people">
>     <xsl:for-each select="peson">
>         <xsl:value-of select="name"/>
>     </xsl:for-each>
>   </xsl:template>
>
> Nathan

Reply | Threaded
Open this post in threaded view
|

RE: How to use refereneces in xsl

Morris, Phil
In reply to this post by Nathan Maves
Have you just used peson not person in your foreach?

 >   <xsl:template match="people">
>     <xsl:for-each select="peson">
>         <xsl:value-of select="name"/>
>     </xsl:for-each>
>   </xsl:template>

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
Sent: Monday, January 09, 2006 3:11 PM
To: [hidden email]
Subject: Re: [xstream-user] How to use refereneces in xsl

Anyone had a chance to look at this?  I am really stuck and not sure  
where else to go?

Nathan

On Jan 6, 2006, at 11:26 AM, Nathan Maves wrote:

> I have cyclical objects that print out the xml using xpath.  How do  
> I actually use this in xsl transformations?
>
>
> example...
>
> <people>
> <person>
> <name>Fred</name>
> </person>
> <person>
> <name>Joe</name>
> </person>
> <person reference="../person[0]"/>
> </people>
>
> below does not work for me.....
>
>   <xsl:template match="people">
>     <xsl:for-each select="peson">
>         <xsl:value-of select="name"/>
>     </xsl:for-each>
>   </xsl:template>
>
> Nathan
Reply | Threaded
Open this post in threaded view
|

Re: How to use refereneces in xsl

Nathan Maves
Phil,

That was just a mock example and a typo :)

My question is if xsl will translate the <person reference=".."/>  to  
the actual node?

Nathan

On Jan 9, 2006, at 8:17 AM, Morris, Phil wrote:

> Have you just used peson not person in your foreach?
>
>>   <xsl:template match="people">
>>     <xsl:for-each select="peson">
>>         <xsl:value-of select="name"/>
>>     </xsl:for-each>
>>   </xsl:template>
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]
> Sent: Monday, January 09, 2006 3:11 PM
> To: [hidden email]
> Subject: Re: [xstream-user] How to use refereneces in xsl
>
> Anyone had a chance to look at this?  I am really stuck and not sure
> where else to go?
>
> Nathan
>
> On Jan 6, 2006, at 11:26 AM, Nathan Maves wrote:
>
>> I have cyclical objects that print out the xml using xpath.  How do
>> I actually use this in xsl transformations?
>>
>>
>> example...
>>
>> <people>
>> <person>
>> <name>Fred</name>
>> </person>
>> <person>
>> <name>Joe</name>
>> </person>
>> <person reference="../person[0]"/>
>> </people>
>>
>> below does not work for me.....
>>
>>   <xsl:template match="people">
>>     <xsl:for-each select="peson">
>>         <xsl:value-of select="name"/>
>>     </xsl:for-each>
>>   </xsl:template>
>>
>> Nathan

Reply | Threaded
Open this post in threaded view
|

Re: How to use refereneces in xsl

Rickard Öberg
Nathan Maves wrote:
> Phil,
>
> That was just a mock example and a typo :)
>
> My question is if xsl will translate the <person reference=".."/>  to  
> the actual node?

Well, "reference" is just your own thing, right? I think the "proper"
way to do it is to use the "id" and "idref" attributes. But in any case
I don't think it will be done automatically. Might depend on the DOM
implementation though. But that's a wild guess.

/Rickard

--
Rickard Öberg
[hidden email]
@work +46-(0)19-173036