cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin D'Allaird <kevin.dalla...@xmls.com>
Subject RE: Matching elements by id
Date Mon, 12 Jun 2000 14:16:11 GMT

That's very similar to how I ended up going about it.  Thanks for your help!

KevinD

-----Original Message-----
From: Nishit Trivedi [mailto:nishit@planet.net]
Sent: Monday, June 12, 2000 10:10 AM
To: cocoon-users@xml.apache.org
Subject: Re: Matching elements by id


As far as I understand your question...I will try my best to answer that..
I am giving you analogy...I don't how you can implement it in your case...
Hope this helps you....otherwise i apologize if i totally misunderstood your
question....

I have two snippets of an xml file...

1.
------------------------------------------------
<Family>
  <Husband Person="1"/>
</Family>
------------------------------------------------
2.
------------------------------------------------
<Person ID="1">
..
..
  <Name> xyz</Name>
</Person>
------------------------------------------------

Here are three snippets of xsl file...
1.
------------------------------------------------
<xsl:template match="Person">
 <xsl:attribute name="name">
   <xsl:value-of select="@ID"/>
 </xsl:attribute>
 <xsl:value-of select="Name"/>
</xsl:template>
------------------------------------------------
2.
------------------------------------------------
<xsl:template match="Family">
 <xsl:apply-templates select="Husband"/>
</xsl:template>
------------------------------------------------
3.
------------------------------------------------
<xsl:template match="Husband">
 <li> Husband's name : <a href="#{@Person}">
   <xsl:value-of select="id(@Person)/Name"/>
 </a>
</li>
</xsl:template>
------------------------------------------------

See in third snippet how id() function chooses the right name of the person
(i.e. xyz) from the xml file.
Also check out in the same snippet how you can call child of an element(e.g.
Person/Name)...

Nishit
Internet Programmer
Planet Access Networks
973-691-4704 Ext:157
----- Original Message -----
From: "Kevin D'Allaird" <kevin.dallaird@xmls.com>
To: <cocoon-users@xml.apache.org>
Sent: Wednesday, June 07, 2000 6:13 PM
Subject: Matching elements by id


>
> Any help with the following would be greatly appreciated.
>
>
> I have the following in an XML file
>
>    <p>To learn more click <link idref="learn_more">here</link>.</p>
>
>
> I have this in the same file
>
> <category id="contact">
> <name>Contact Us</name>
> <uri>contact/</uri>
> <resource type="page" id="learn_more">
> <name>Learn More</name>
> <uri>learn_more.xml</uri>
> </resource>
> ....
>   </category>
>
>
> I would like to transform <link> .... </link> to
> <a href="learn_more.xml">here</a>
>
> i.e. find the element with id equal to the value of idref and return the
> value of child uri
>
> Once that works, I will add the element's ancestor's uris to create a
> full-path to the resource.
>
> I just can't seem to nail it down.  Any ideas?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>


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

Mime
View raw message