cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cumming...@netscape.net (Steven Cummings)
Subject Re: URI parts extraction
Date Wed, 20 Nov 2002 18:05:48 GMT
Yatin,

You could just pass the whole URI in as one parameter and write templates that recursively
extract the parts. It's a little tedious, but it can be done. I don't have an example handy
but O'Reilly's "XSLT" by Doug Tidwell comes to mind (because that's where I learned the technique).
I recommend having that book nearby if you're going to do any serious amount of XSLT writing.
HTH.

/S

Yatin Shah <nospam@kripa.com> wrote:

>  Thanks Steven.
>
>The URI can have variable number of dirs.
>
>So the wildcard matcher with it's keys will not help.
>(ie. <map:match pattern="*/*/*/*"> where {1} is dir1, {2} is dir2, ..etc 
>can't be used since URI does not have fixed number of dirs.)
>Are there any other options?
>If I use XSL tranform then question still remains as how to get the 
>variable number of param values?
>
>Thank
>
>Steven Cummings wrote:
>
>>Yatin,
>>
>>I would suggest writing an XSL Transform that you pass the URI parts to as parameters.
You'll have to generate a dummy document to initiate the transformation.
>>
>>The template will look something like this:
>>
>><!-- Globar params should get values from the sitemap. -->
>><xsl:param name="dir1"/>
>><xsl:param name="dir2"/>
>><xsl:param name="dir3"/>
>><xsl:param name="dir4"/>
>><xsl:param name="file1"/>
>><xsl:template match="/">
>>  <uri>
>>    <node> cocoon </node>
>>    <node> <xsl:value-of select="$dir1"/> </node>
>>    <node> <xsl:value-of select="$dir2"/> </node>
>>    <node> <xsl:value-of select="$dir3"/> </node>
>>    <node> <xsl:value-of select="$dir4"/>
>>      <leaf><xsl:value-of select="$file1"/></leaf>
>>    </node>
>>  </uri>
>></xsl:template>
>>
>>I'm assuming you have a fixed number of dirs before the file. Hope this helps.
>>
>>/S
>>
>>Yatin Shah <nospam@kripa.com> wrote:
>>
>>  
>>
>>>Is there an existing component(a Matcher!) which will extract individual
>>>names from a URI?
>>>What I want is:
>>>Given http://hostname/cocoon/dir1/dir2/dir3/dir4/file1
>>>I want XML file as follows:
>>>
>>><uri>
>>><node> cocoon </node>
>>><node> dir1 </node>
>>><node> dir2 </node>
>>><node> dir3 </node>
>>><node> dir4
>>>  <leaf>file1</leaf>
>>></node>
>>></uri>
>>>
>>>[Although I do not need it, we can have <hostname>,<port>,<protocol>

>>>tags to the xml file as well].
>>>-Yatin
>>>
>>>-- 
>>>Yatin Shah, President                       mailto:ygs@kripa.com
>>>Kripa Inc.                                  http://www.kripa.com
>>>Dayton, New Jersey USA                      phone:  732.329.8303
>>>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>>Developers of real time event driven distributed DB applications
>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>Please check that your question  has not already been answered in the
>>>FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>>>
>>>To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
>>>For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
>>>
>>>
>>>    
>>>
>>
>>
>>  
>>
>
>
>---------------------------------------------------------------------
>Please check that your question  has not already been answered in the
>FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
>To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
>For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
>
>


-- 
Steven Cummings
Columbia, MO
Email: cummingscs@netscape.net
AIM:   cummingscs
ICQ:   3330114


__________________________________________________________________
The NEW Netscape 7.0 browser is now available. Upgrade now! http://channels.netscape.com/ns/browsers/download.jsp


Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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