RE: XPath transformer?

2002-09-03 Thread Luca Morandini

Jeff,

it came up to my mind just now... why don't you use a Xalan extension ? There is an 
evaluate function in there for such cases.
Though I never use it, it seems to fit the bill: see for youself at
http://xml.apache.org/xalan-j/extensionslib.html#evaluate .

Best regards,

-
   Luca Morandini
   GIS Consultant
  [EMAIL PROTECTED]
http://utenti.tripod.it/lmorandini/index.html
-


 -Original Message-
 From: Jeff Turner [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, September 03, 2002 3:46 AM
 To: [EMAIL PROTECTED]
 Subject: Re: XPath transformer?


 On Fri, Aug 30, 2002 at 10:55:03AM +0200, Luca Morandini wrote:
   Not easily, because the 'match' attribute cannot be dynamic. Eg, I
 
  Oh, I see... so you want a *dynamic* selector.
 
  Hmm... this was not apparent from your example, It seemed you wanted
  just a way to select one chapter amongst many.
 
  Anyway, I think you should dirt your fingers with Xalan to get want you
  want.

 Yes, it can be done with document()

  I cannot appreciate if this prospective XPathTransformer could be
  of general use, though... I never had such a need myself.

 FTR, I submitted an XPathTransformer at
 http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12235

 --Jeff


  Best regards,
 
 
  -
 Luca Morandini
 GIS Consultant
[EMAIL PROTECTED]
  http://utenti.tripod.it/lmorandini/index.html
  -

 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: XPath transformer?

2002-09-03 Thread Nicola Ken Barozzi


Luca Morandini wrote:
 Jeff,
 
 it came up to my mind just now... why don't you use a Xalan extension ? There is an 
evaluate function in there for such cases.
 Though I never use it, it seems to fit the bill: see for youself at
 http://xml.apache.org/xalan-j/extensionslib.html#evaluate .

It's Xalan proprietary, and is much slower than just Xpath.

Jeff did The Right Thing (TM), a Transformer is the best thing for this.

-- 
Nicola Ken Barozzi   [EMAIL PROTECTED]
 - verba volant, scripta manent -
(discussions get forgotten, just code remains)
-


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: XPath transformer?

2002-09-02 Thread Jeff Turner

On Fri, Aug 30, 2002 at 10:55:03AM +0200, Luca Morandini wrote:
  Not easily, because the 'match' attribute cannot be dynamic. Eg, I
 
 Oh, I see... so you want a *dynamic* selector.
 
 Hmm... this was not apparent from your example, It seemed you wanted
 just a way to select one chapter amongst many.
 
 Anyway, I think you should dirt your fingers with Xalan to get want you
 want.

Yes, it can be done with document()

 I cannot appreciate if this prospective XPathTransformer could be
 of general use, though... I never had such a need myself.

FTR, I submitted an XPathTransformer at
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12235

--Jeff


 Best regards,
 
 
 -
Luca Morandini
GIS Consultant
   [EMAIL PROTECTED]
 http://utenti.tripod.it/lmorandini/index.html
 -

-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




RE: XPath transformer?

2002-08-30 Thread Luca Morandini

Jeff,

you need just an XSLT transformer for this purpose: use a stylesheet that matches the 
wanted element and discards the rest. 

Best regards,

- 
   Luca Morandini 
   GIS Consultant 
  [EMAIL PROTECTED] 
http://utenti.tripod.it/lmorandini/index.html 
-
 

 -Original Message-
 From: Jeff Turner [mailto:[EMAIL PROTECTED]]
 Sent: Friday, August 30, 2002 10:25 AM
 To: [EMAIL PROTECTED]
 Subject: XPath transformer?
 
 
 Hi,
 
 I have a user manual in XML format:
 
 document
   body
 s1 title=Introduction
   ...
 /s1
 s1 title=Getting Started
   ...
 /s1
 ...
   /body
 /document
 
 Is there any way that I could extract out just one s1 element, and
 render it as a page? Ie, like an XPath transformer, that would extract a
 single node:
 
 map:match pattern=manual/*
   map:generate src=manual.xml/
   map:transform type=xpath select=/document/s1[@title='{1}']/
   map:transform src=chapter2html.xsl/
 /map:match
 
 I could then link to chapters with link
 href=manual/Introductionintroduction/link.
 
 Is this possible, or should I write my own transformer?
 
 thanks,
 
 --Jeff
 
 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]
 

-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




RE: XPath transformer?

2002-08-30 Thread Koen Pellegrims

What you are trying to do can just as easily be achieved with xslt, can't
it?

If you *really* want xpath, you can always write a small xsp-page that
generates an xinclude-statement and then run it through the
xinclude-transformer (which, IIRC will be merged with the cinclude
transformer into a single 'include'-transformer in the near future).

K.

 -Oorspronkelijk bericht-
 Van: Jeff Turner [mailto:[EMAIL PROTECTED]]
 Verzonden: vrijdag 30 augustus 2002 10:25
 Aan: [EMAIL PROTECTED]
 Onderwerp: XPath transformer?


 Hi,

 I have a user manual in XML format:

 document
   body
 s1 title=Introduction
   ...
 /s1
 s1 title=Getting Started
   ...
 /s1
 ...
   /body
 /document

 Is there any way that I could extract out just one s1 element, and
 render it as a page? Ie, like an XPath transformer, that would extract a
 single node:

 map:match pattern=manual/*
   map:generate src=manual.xml/
   map:transform type=xpath select=/document/s1[@title='{1}']/
   map:transform src=chapter2html.xsl/
 /map:match

 I could then link to chapters with link
 href=manual/Introductionintroduction/link.

 Is this possible, or should I write my own transformer?

 thanks,

 --Jeff

 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]




-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




RE: XPath transformer?

2002-08-30 Thread Piroumian Konstantin

 From: Jeff Turner [mailto:[EMAIL PROTECTED]] 
 
 Hi,
 
 I have a user manual in XML format:
 
 document
   body
 s1 title=Introduction
   ...
 /s1
 s1 title=Getting Started
   ...
 /s1
 ...
   /body
 /document
 
 Is there any way that I could extract out just one s1 element, and
 render it as a page? Ie, like an XPath transformer, that 
 would extract a
 single node:

If you need a pagination based on section elements then it's worth to take a
look at Stefano's PaginatingTransformer. You'll find documentation on it
here: http://xml.apache.org/cocoon/howto/howto-paginator-transformer.html. 


Hope it'll help you to solve your problem and also hope to see it applied to
Forrest. 

--
Konstantin

 
 map:match pattern=manual/*
   map:generate src=manual.xml/
   map:transform type=xpath select=/document/s1[@title='{1}']/
   map:transform src=chapter2html.xsl/
 /map:match
 
 I could then link to chapters with link
 href=manual/Introductionintroduction/link.
 
 Is this possible, or should I write my own transformer?
 
 thanks,
 
 --Jeff
 
 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]
 

-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: XPath transformer?

2002-08-30 Thread Jeff Turner

Thanks (Luca too:) for the rapid replies.

On Fri, Aug 30, 2002 at 10:21:47AM +0200, Koen Pellegrims wrote:
 What you are trying to do can just as easily be achieved with xslt, can't
 it?

Not easily, because the 'match' attribute cannot be dynamic. Eg, I
couldn't do:

xsl:param name=xpath-expr/

xsl:template match=$xpath-expr
  xsl:copy-of select=./
/xsl:template

AFAIK this is for the same reason that Cocoon doesn't currently have an
XPath matcher.

 If you *really* want xpath, you can always write a small xsp-page that
 generates an xinclude-statement and then run it through the
 xinclude-transformer (which, IIRC will be merged with the cinclude
 transformer into a single 'include'-transformer in the near future).

That's a good idea. I'll have a go.

thanks,

--Jeff

 K.
 
  -Oorspronkelijk bericht-
  Van: Jeff Turner [mailto:[EMAIL PROTECTED]]
  Verzonden: vrijdag 30 augustus 2002 10:25
  Aan: [EMAIL PROTECTED]
  Onderwerp: XPath transformer?
 
 
  Hi,
 
  I have a user manual in XML format:
 
  document
body
  s1 title=Introduction
...
  /s1
  s1 title=Getting Started
...
  /s1
  ...
/body
  /document
 
  Is there any way that I could extract out just one s1 element, and
  render it as a page? Ie, like an XPath transformer, that would extract a
  single node:
 
  map:match pattern=manual/*
map:generate src=manual.xml/
map:transform type=xpath select=/document/s1[@title='{1}']/
map:transform src=chapter2html.xsl/
  /map:match
 
  I could then link to chapters with link
  href=manual/Introductionintroduction/link.
 
  Is this possible, or should I write my own transformer?
 
  thanks,
 
  --Jeff
 
  -
  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: [EMAIL PROTECTED]
  For additional commands, e-mail:   [EMAIL PROTECTED]
 
 
 
 
 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]
 

-- 
Hell is a state of mind. And every state of mind, left to itself,
every shutting up of the creature within the dungeon of it's own
mind -- is, in the end, Hell.
  C.S. Lewis, _The Great Divorce_

-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




RE: XPath transformer?

2002-08-30 Thread Luca Morandini

 Not easily, because the 'match' attribute cannot be dynamic. Eg, I

Oh, I see... so you want a *dynamic* selector.

Hmm... this was not apparent from your example, It seemed you wanted just a way to 
select one chapter amongst many.

Anyway, I think you should dirt your fingers with Xalan to get want you want. I cannot 
appreciate if this prospective
XPathTransformer could be of general use, though... I never had such a need myself.

Best regards,


-
   Luca Morandini
   GIS Consultant
  [EMAIL PROTECTED]
http://utenti.tripod.it/lmorandini/index.html
-


 -Original Message-
 From: Jeff Turner [mailto:[EMAIL PROTECTED]]
 Sent: Friday, August 30, 2002 11:01 AM
 To: [EMAIL PROTECTED]
 Subject: Re: XPath transformer?


 Thanks (Luca too:) for the rapid replies.

 On Fri, Aug 30, 2002 at 10:21:47AM +0200, Koen Pellegrims wrote:
  What you are trying to do can just as easily be achieved with xslt, can't
  it?

 Not easily, because the 'match' attribute cannot be dynamic. Eg, I
 couldn't do:

 xsl:param name=xpath-expr/

 xsl:template match=$xpath-expr
   xsl:copy-of select=./
 /xsl:template

 AFAIK this is for the same reason that Cocoon doesn't currently have an
 XPath matcher.

  If you *really* want xpath, you can always write a small xsp-page that
  generates an xinclude-statement and then run it through the
  xinclude-transformer (which, IIRC will be merged with the cinclude
  transformer into a single 'include'-transformer in the near future).

 That's a good idea. I'll have a go.

 thanks,

 --Jeff

  K.
 
   -Oorspronkelijk bericht-
   Van: Jeff Turner [mailto:[EMAIL PROTECTED]]
   Verzonden: vrijdag 30 augustus 2002 10:25
   Aan: [EMAIL PROTECTED]
   Onderwerp: XPath transformer?
  
  
   Hi,
  
   I have a user manual in XML format:
  
   document
 body
   s1 title=Introduction
 ...
   /s1
   s1 title=Getting Started
 ...
   /s1
   ...
 /body
   /document
  
   Is there any way that I could extract out just one s1 element, and
   render it as a page? Ie, like an XPath transformer, that would extract a
   single node:
  
   map:match pattern=manual/*
 map:generate src=manual.xml/
 map:transform type=xpath select=/document/s1[@title='{1}']/
 map:transform src=chapter2html.xsl/
   /map:match
  
   I could then link to chapters with link
   href=manual/Introductionintroduction/link.
  
   Is this possible, or should I write my own transformer?
  
   thanks,
  
   --Jeff
  
   -
   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: [EMAIL PROTECTED]
   For additional commands, e-mail:   [EMAIL PROTECTED]
  
  
 
 
  -
  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: [EMAIL PROTECTED]
  For additional commands, e-mail:   [EMAIL PROTECTED]
 

 --
 Hell is a state of mind. And every state of mind, left to itself,
 every shutting up of the creature within the dungeon of it's own
 mind -- is, in the end, Hell.
   C.S. Lewis, _The Great Divorce_

 -
 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: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]



-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: XPath transformer?

2002-08-30 Thread Nicola Ken Barozzi


Jeff Turner wrote:
 Thanks (Luca too:) for the rapid replies.
 
 On Fri, Aug 30, 2002 at 10:21:47AM +0200, Koen Pellegrims wrote:
 
What you are trying to do can just as easily be achieved with xslt, can't
it?
 
 
 Not easily, because the 'match' attribute cannot be dynamic. Eg, I
 couldn't do:
 
 xsl:param name=xpath-expr/
 
 xsl:template match=$xpath-expr
   xsl:copy-of select=./
 /xsl:template

Look at the HTMLGenerator.
Probably you can retrofit the behaviour to the XMLGenerator or to a 
Transformer.

map:match pattern=yahoo
 map:generate src=http://www.yahoo.com; type=html
   map:parameter name=xpath 
value=/html/body/center/table[4]/tr[1]/td[1]/table[2]/tr[1]/td[1]/center[1]/
 /map:generate
 map:transform src=stylesheets/news/news.xsl/
 map:serialize type=html/
/map:match

-- 
Nicola Ken Barozzi   [EMAIL PROTECTED]
 - verba volant, scripta manent -
(discussions get forgotten, just code remains)
-


-
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: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]