RE: XPathDirectory generator styling help

2006-11-17 Thread J.D. Williams
Thanks, Andrew.

Yes, that worked perfectly. It lops off the .xml extension to give you
a Cocoon-style url.

Now...on to another issue. ;)

Joe

On Fri, 2006-11-10 at 18:09 +, Andrew Stevens wrote:
 From: J.D. Williams [EMAIL PROTECTED]
 Reply-To: users@cocoon.apache.org
 To: users@cocoon.apache.org
 Subject: RE: XPathDirectory generator styling help
 Date: Fri, 10 Nov 2006 08:31:30 -0600
 
 Hi Ard,
 
 I did, in fact, get it to work with some tweaking of the xsl. The
 snippets follow.
 
 What I would like to do now is strip the .xml file extension from the
 resulting href in the html. Suggestions?
 
  xsl:template match=dir:file
  xsl:element name=a
  xsl:attribute name=href
  xsl:value-of select=@name/
  /xsl:attribute
  xsl:apply-templates select=dir:xpath/
  /xsl:element
  /xsl:template
 
 How about
 xsl:attribute name=href
 xsl:value-of select=substring-before(@name, '.xml')/
 /xsl:attribute
 ?  Or, if you think the characters .xml may appear more than once in the 
 filename (substring-before only looks up to the first occurrence) then maybe
 xsl:attribute name=href
 xsl:value-of select=substring(@name, 1, 
 string-length(@name) - 4)/
 /xsl:attribute
 would be better?  That assumes you don't also have e.g. any .js files in the 
 directory, though.
 
 
 Andrew.
 --
 http://pseudoq.sourceforge.net/
 
 _
 Windows Live Messenger has arrived. Click here to download it for free! 
 http://imagine-msn.com/messenger/launch80/?locale=en-gb
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: XPathDirectory generator styling help

2006-11-10 Thread J.D. Williams
Hi Ard,

I did, in fact, get it to work with some tweaking of the xsl. The
snippets follow.

What I would like to do now is strip the .xml file extension from the
resulting href in the html. Suggestions?

Joe

P.S. Here is what works.

From this sitemap matcher...

map:match pattern=articles/
map:generate type=xpathdirectory src=articles
map:parameter name=xpath value=/topic/title/
map:parameter name=xmlFiles value=\.x.*$/
/map:generate
map:transform src=mydir2html.xsl/
map:serialize type=html/
/map:match

...we get the title of each article for use as text in the resulting
html a element.

The following xsl...

xsl:template match=/dir:directory
xsl:apply-templates select=dir:directory/
 /xsl:template

xsl:template match=dir:directory
xsl:apply-templates/
/xsl:template

xsl:template match=dir:file
xsl:element name=a
xsl:attribute name=href
xsl:value-of select=@name/
/xsl:attribute
xsl:apply-templates select=dir:xpath/
/xsl:element
/xsl:template

xsl:template match=dir:xpath
xsl:value-of select=title/
/xsl:template

...uses the name attribute of each file in the XPathGenerator result as
the href of the a elements in the resulting html...

html
head
title/
/head

body
table id=body
tr
td id=articles
h4 class=menuheaderArticles/h4
a href=article1.xmlArticle the first/a
a href=article2.xmlArticle the second/a
/td
/tr
/table
/body
/html

...which is all ready for tweaking and CSS-ifying and whatever you want
to do to it.

On Mon, 2006-11-06 at 21:28 +0100, Ard Schrijvers wrote:
 Hello,
 
 did you manage to get it to work? Think you have some problems with xml/xsl 
 transformations. Also take into account the namespaces. If you are still 
 having problems, please let us know, or subscribe to some xsl mailinglist, 
 like http://www.mulberrytech.com/xsl/xsl-list/.
 
 Your problem is only xsl related, not browser. 
 
 Regards
 
 
  
  I would like to be able to drop valid xml files into a directory and
  have them appear automagically in a menu, with the ability to 
  transform
  the title of the article in the file into the text of a link 
  if I want.
  
  I get the XPathDirectory generator to work with the following pipeline
  matcher.
  
  map:match pattern=articles/*
  map:generate type=xpathdirectory src=articles/{1}
  map:parameter name=xpath value=title/
  map:parameter name=xmlFiles value=\.x.*$/
  /map:generate
  map:serialize type=xml/
  /map:match
  
  The above matcher produces the following output.
  
  ?xml version=1.0 encoding=ISO-8859-1?
  dir:directory xmlns:dir=http://apache.org/cocoon/directory/2.0;
  name=articles lastModified=1162301516000 date=31/10/06 07:31
  size=4096 sort=name reverse=false requested=true
  dir:file name=article1.xml lastModified=116231223
  date=31/10/06 10:30 size=136
  dir:xpath query=title
  titleArticle title/title
  /dir:xpath
  /dir:file
  /dir:directory
  
  So far, so good. 
  
  However, I would like to transform the XML so I can do other 
  things with
  it, such as a quick and dirty dynamic HTML menu or aggregate into
  another web page as XML and subsequently transform the title elements
  into links. I have attempted the following.
  
  xsl:template match=/
  xsl:apply-templates/
  /xsl:template
  
  xsl:template match=article
  xsl:value-of select=title/
  /xsl:template
  
  When I add this XSL to the matcher, still serializing as XML 
  I get this
  result (when viewing the source).
  
  ?xml version=1.0 encoding=ISO-8859-1?Article title
  
  Which looks OK, but Firefox complains with the following error.
  
  XML Parsing Error: syntax error
  Location: http://localhost:8080/sandbox/articles/
  Line Number 1, Column 44:?xml version=1.0
  encoding=ISO-8859-1?Article title
  ---^
  Why is it encoded as ISO-8859-1? Everything in my sitemap says UTF-8.
  
  This happens regardless of the charset I specify in Firefox. 
  Amaya also
  complains. 
  
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: XPathDirectory generator styling help

2006-11-10 Thread Andrew Stevens

From: J.D. Williams [EMAIL PROTECTED]
Reply-To: users@cocoon.apache.org
To: users@cocoon.apache.org
Subject: RE: XPathDirectory generator styling help
Date: Fri, 10 Nov 2006 08:31:30 -0600

Hi Ard,

I did, in fact, get it to work with some tweaking of the xsl. The
snippets follow.

What I would like to do now is strip the .xml file extension from the
resulting href in the html. Suggestions?



xsl:template match=dir:file
xsl:element name=a
xsl:attribute name=href
xsl:value-of select=@name/
/xsl:attribute
xsl:apply-templates select=dir:xpath/
/xsl:element
/xsl:template


How about
   xsl:attribute name=href
   xsl:value-of select=substring-before(@name, '.xml')/
   /xsl:attribute
?  Or, if you think the characters .xml may appear more than once in the 
filename (substring-before only looks up to the first occurrence) then maybe

   xsl:attribute name=href
   xsl:value-of select=substring(@name, 1, 
string-length(@name) - 4)/

   /xsl:attribute
would be better?  That assumes you don't also have e.g. any .js files in the 
directory, though.



Andrew.
--
http://pseudoq.sourceforge.net/

_
Windows LiveĀ™ Messenger has arrived. Click here to download it for free! 
http://imagine-msn.com/messenger/launch80/?locale=en-gb



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: XPathDirectory generator styling help

2006-11-10 Thread J.D. Williams
Hi Andrew,

I will give this a try and report back. I have a couple other things
before I get back to this particular project.

Joe

 
 How about
 xsl:attribute name=href
 xsl:value-of select=substring-before(@name, '.xml')/
 /xsl:attribute
 ?  Or, if you think the characters .xml may appear more than once in the 
 filename (substring-before only looks up to the first occurrence) then maybe
 xsl:attribute name=href
 xsl:value-of select=substring(@name, 1, 
 string-length(@name) - 4)/
 /xsl:attribute
 would be better?  That assumes you don't also have e.g. any .js files in the 
 directory, though.
 
 
 Andrew.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: XPathDirectory generator styling help

2006-11-06 Thread Ard Schrijvers
Hello,

did you manage to get it to work? Think you have some problems with xml/xsl 
transformations. Also take into account the namespaces. If you are still having 
problems, please let us know, or subscribe to some xsl mailinglist, like 
http://www.mulberrytech.com/xsl/xsl-list/.

Your problem is only xsl related, not browser. 

Regards


 
 I would like to be able to drop valid xml files into a directory and
 have them appear automagically in a menu, with the ability to 
 transform
 the title of the article in the file into the text of a link 
 if I want.
 
 I get the XPathDirectory generator to work with the following pipeline
 matcher.
 
 map:match pattern=articles/*
   map:generate type=xpathdirectory src=articles/{1}
   map:parameter name=xpath value=title/
   map:parameter name=xmlFiles value=\.x.*$/
   /map:generate
   map:serialize type=xml/
 /map:match
 
 The above matcher produces the following output.
 
 ?xml version=1.0 encoding=ISO-8859-1?
 dir:directory xmlns:dir=http://apache.org/cocoon/directory/2.0;
 name=articles lastModified=1162301516000 date=31/10/06 07:31
 size=4096 sort=name reverse=false requested=true
   dir:file name=article1.xml lastModified=116231223
 date=31/10/06 10:30 size=136
   dir:xpath query=title
   titleArticle title/title
   /dir:xpath
   /dir:file
 /dir:directory
 
 So far, so good. 
 
 However, I would like to transform the XML so I can do other 
 things with
 it, such as a quick and dirty dynamic HTML menu or aggregate into
 another web page as XML and subsequently transform the title elements
 into links. I have attempted the following.
 
 xsl:template match=/
 xsl:apply-templates/
 /xsl:template
 
 xsl:template match=article
 xsl:value-of select=title/
 /xsl:template
 
 When I add this XSL to the matcher, still serializing as XML 
 I get this
 result (when viewing the source).
 
 ?xml version=1.0 encoding=ISO-8859-1?Article title
 
 Which looks OK, but Firefox complains with the following error.
 
 XML Parsing Error: syntax error
 Location: http://localhost:8080/sandbox/articles/
 Line Number 1, Column 44:?xml version=1.0
 encoding=ISO-8859-1?Article title
   ---^
 Why is it encoded as ISO-8859-1? Everything in my sitemap says UTF-8.
 
 This happens regardless of the charset I specify in Firefox. 
 Amaya also
 complains. 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: XPathDirectory generator styling help

2006-10-31 Thread Scott Warren
Your output is not correct XML. You need to add an element around the text for example change you XSL to thisxsl:template match=/
 articles   xsl:apply-templates/ /articles/xsl:templatexsl:template match=article
 article xsl:value-of select=title/ /article/xsl:template
On 11/1/06, J.D. Williams [EMAIL PROTECTED] wrote:
I would like to be able to drop valid xml files into a directory andhave them appear automagically in a menu, with the ability to transformthe title of the article in the file into the text of a link if I want.
I get the XPathDirectory generator to work with the following pipelinematcher.map:match pattern=articles/*map:generate type=xpathdirectory src=""
map:parameter name=xpath value=title/map:parameter name=xmlFiles value=\.x.*$//map:generatemap:serialize type=xml/
/map:matchThe above matcher produces the following output.?xml version=1.0 encoding=ISO-8859-1?dir:directory xmlns:dir=
http://apache.org/cocoon/directory/2.0name=articles lastModified=1162301516000 date=31/10/06 07:31size=4096 sort=name reverse=false requested=true
dir:file name=article1.xml lastModified=116231223date=31/10/06 10:30 size=136dir:xpath query=titletitleArticle title/title
/dir:xpath/dir:file/dir:directorySo far, so good.However, I would like to transform the XML so I can do other things withit, such as a quick and dirty dynamic HTML menu or aggregate into
another web page as XML and subsequently transform the title elementsinto links. I have attempted the following.xsl:template match=/xsl:apply-templates//xsl:template
xsl:template match=articlexsl:value-of select=title//xsl:templateWhen I add this XSL to the matcher, still serializing as XML I get this
result (when viewing the source).?xml version=1.0 encoding=ISO-8859-1?Article titleWhich looks OK, but Firefox complains with the following error.XML Parsing Error: syntax error
Location: http://localhost:8080/sandbox/articles/Line Number 1, Column 44:?xml version=1.0encoding=ISO-8859-1?Article title
---^Why is it encoded as ISO-8859-1? Everything in my sitemap says UTF-8.This happens regardless of the charset I specify in Firefox. Amaya also
complains.-To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]