Re: Finding CSS files in webapp

2004-07-12 Thread Nikola Milutinovic
Peter Rossbach wrote:
Hey,
I think your browser is the problem. Generate absolute css link that help
% String url = request.getScheme() + :// + request.getServerName() + 
: + request.getServerPort() + request.getContextPath() ; %

 link rel=stylesheet type=text/css
   href=%=url%/css/nrd.css /
Or a relative link, which might get some complaints from the browser (my 
Dreamweaver always complains if the relative path goes outside some 
scope). The original poster has failed to give us an important clue. How 
is XHTML file getting generated? To what URI it responds?

That URI is what browser sees and a LINK's href is relative to that base.
So if you have an URI: http://server.domain.com/nrd/mypath/file.xhtml, 
which gets mapped via Controller to XSLT processing engine and 
generates a XHTML document in response, the the href of link ... 
should be ../css/nrd.css.

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


RE: Finding CSS files in webapp

2004-07-12 Thread David . Pawson
Xalan or Saxon have no 'base' from which to determine
the context for the css file, so you'll have to use
an absolute file reference from the stylesheet.

Came up on the Saxon list this week.
Its for the document() function, but the same logic applies.

HTH DaveP

quote
 It appears that I must use a full path when using the 
 xsl:result-document command from a saxon servlet.
 
 For example: xsl:result-document href=file:/c:/mywebdir/myfile.htm 
 format=web
 
 rather than: xsl:result-document href=file:/../../myfile.htm 
 format=web
 
 Is this true, or is it possible to use a relative path?

Although it's possible in principle to use a relative path, this isn't
likely to be convenient in a servlet environment. Any relative URI is
resolved relative to the base URI of the principal output document, which in
the servlet case is going to the servlet output streat, which doesn't have a
meaningful URI. You could, when you allocate the principal output
destination, give it an arbitrary URI for this purpose:

ServletOutputStream out = res.getOutputStream(); StreamResult tout = new
StreamResult(out); tout.setSystemId(file:/c:/some/uri/);
transformer.transform(new StreamSource(sourceFile), tout);

However, I'm wondering what you're actually trying to do here. Where do you
want to put the extra output files? Is it a location associated with the
individual end user, or a location associated with the source document, or
what? Are you trying to split the source document into multiple result
documents the first time it is accessed, and cache the results for later
use? Do you actually want to serialize the multiple output documents to
disk, or do you really want them in (application or session) memory?

 Also, there is no
 'c:' on Unix\Linux, so would I use something like 
 'href=file://mywebdir/myfile.html' ??

I think the correct syntax is file:///usr/dir/file.xml to reference the UNIX
file /user/dir/file.xml
 
 I'm new to the Servlet environment.. I'm not sure how to obtain the 
 full path if I'm running my Servlet on a hosted machine. Do I have to 
 ask the host provider and hard code the path or is there a dynamic way 
 to do this?
 

If you're running on a hosted machine then you'll have to write the files to
a directory where the servlet has write permission. A Java call such as

getServletContext().getRealPath(source);

will give you path names to files within the directory structure visible to
users via a browser - it's not clear whether you want the XML files you
generate to be directly accessible to users or not.

Michael Kay
/quote

-- 
DISCLAIMER: 

NOTICE: The information contained in this email and any attachments is 
confidential and may be privileged. If you are not the intended 
recipient you should not use, disclose, distribute or copy any of the 
content of it or of any attachment; you are requested to notify the 
sender immediately of your receipt of the email and then to delete it 
and any attachments from your system. 

RNIB endeavours to ensure that emails and any attachments generated by 
its staff are free from viruses or other contaminants. However, it 
cannot accept any responsibility for any  such which are transmitted.
We therefore recommend you scan all attachments. 

Please note that the statements and views expressed in this email and 
any attachments are those of the author and do not necessarily represent 
those of RNIB. 

RNIB Registered Charity Number: 226227 

Website: http://www.rnib.org.uk 

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



Re: Finding CSS files in webapp

2004-07-12 Thread William BC Crandall
Thanks Peter, for opening a new line of inquiry. The solution I came up
with is not unlike Michael's recommendation as forwarded by DaveP.

What I did:

   Got real path (in class that initiates transformation):

  ServletContext ctx = servlet.getServletContext();
  String cssFileName  = ctx.getRealPath(/css/nrd.css);

   Passed it to the Transformer:

  trans.setParameter(cssFile, cssFileName);

   Then added param at top of stylesheet, and used it in place:

  xsl:param name=cssFile select='passedIn'/

  link rel=stylesheet type=text/css href={$cssFile}/

Thanks to all for helpful pointers.

Best,

William BC Crandall
bc.crandall [around] earthlink.net


- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 12 July 2004 1:18 AM
Subject: RE: Finding CSS files in webapp


 Xalan or Saxon have no 'base' from which to determine
 the context for the css file, so you'll have to use
 an absolute file reference from the stylesheet.

 Came up on the Saxon list this week.
 Its for the document() function, but the same logic applies.

 HTH DaveP

 quote
  It appears that I must use a full path when using the
  xsl:result-document command from a saxon servlet.
 
  For example: xsl:result-document href=file:/c:/mywebdir/myfile.htm
  format=web
 
  rather than: xsl:result-document href=file:/../../myfile.htm
  format=web
 
  Is this true, or is it possible to use a relative path?

 Although it's possible in principle to use a relative path, this isn't
 likely to be convenient in a servlet environment. Any relative URI is
 resolved relative to the base URI of the principal output document, which
in
 the servlet case is going to the servlet output streat, which doesn't have
a
 meaningful URI. You could, when you allocate the principal output
 destination, give it an arbitrary URI for this purpose:

 ServletOutputStream out = res.getOutputStream(); StreamResult tout = new
 StreamResult(out); tout.setSystemId(file:/c:/some/uri/);
 transformer.transform(new StreamSource(sourceFile), tout);

 However, I'm wondering what you're actually trying to do here. Where do
you
 want to put the extra output files? Is it a location associated with the
 individual end user, or a location associated with the source document, or
 what? Are you trying to split the source document into multiple result
 documents the first time it is accessed, and cache the results for later
 use? Do you actually want to serialize the multiple output documents to
 disk, or do you really want them in (application or session) memory?

  Also, there is no
  'c:' on Unix\Linux, so would I use something like
  'href=file://mywebdir/myfile.html' ??

 I think the correct syntax is file:///usr/dir/file.xml to reference the
UNIX
 file /user/dir/file.xml
 
  I'm new to the Servlet environment.. I'm not sure how to obtain the
  full path if I'm running my Servlet on a hosted machine. Do I have to
  ask the host provider and hard code the path or is there a dynamic way
  to do this?
 

 If you're running on a hosted machine then you'll have to write the files
to
 a directory where the servlet has write permission. A Java call such as

 getServletContext().getRealPath(source);

 will give you path names to files within the directory structure visible
to
 users via a browser - it's not clear whether you want the XML files you
 generate to be directly accessible to users or not.

 Michael Kay
 /quote

 -- 


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



Re: Finding CSS files in webapp

2004-07-11 Thread Peter Rossbach
Hey,
I think your browser is the problem. Generate absolute css link that help
% String url = request.getScheme() + :// + request.getServerName() + 
: + request.getServerPort() + request.getContextPath() ; %

 link rel=stylesheet type=text/css
   href=%=url%/css/nrd.css /
regards
peter
William BC Crandall schrieb:
Greetings fellow Tomcat dancers,
Been losing cycles in a gumption trap, trying to hook a CSS file 
up to XSLT-generated XHTML pages. Many thanks to whomever sees 
my obvious error.

If I hardwire the full-path filename of my development environment 
into the XSLT file, all works as hoped/planned/dreamed. But all 
other techniques I've tried fail. 

Tomcat: 5.0.19. Webapp name: nrd.
WAR layout:
 |-nrd
   |-css/nrd.css
   |-images/
   |-Meta-inf/
   |-Web-inf/
 |-classes/
 |-dtd/
 |-lib/
 |-xsl/
 |-web.xml
web.xml:
   web-app
 servlet
   servlet-name
 controller
   /servlet-name
   servlet-class
 org.apnp.nrd.ControlServlet
   /servlet-class
 /servlet
 servlet-mapping
   servlet-name
 controller
   /servlet-name
   url-pattern
 /*
   /url-pattern
 /servlet-mapping
   /web-app
XSLT source that works:
   head
 meta http-equiv=Content-Type
   content=application/xhtml+xml; charset=utf-8/
   
 link rel=stylesheet type=text/css
   href=C:\Apache\Tomcat\Tomcat50\webapps\nrd\css\nrd.css/
   /head

Versions of CSS href that do not work:
   href=css/nrd.css/
   href=/css/nrd.css/
   href=./css/nrd.css/
   href=nrd/css/nrd.css/
   href=/nrd/css/nrd.css/
   href=./nrd/css/nrd.css/
I've also tried setting a global XSLT parameter:
 xsl:param name=rootDir select='../docroot'/
and calling that:
 link rel=stylesheet type=text/css
   href={$rootDir}css/nrd.css/
which results in a known unsuccesful link:
   href=/nrd/css/nrd.css 

Please, if you can, tell me what obvious thing I've missed.
Thanks for any suggestions.
Best wishes,
William BC Crandall
bc.crandall [around] earthlink.net
-
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: Finding CSS files in webapp

2004-07-11 Thread Harry Mantheakis
Hello

I have no knowledge of XSLT-generated XHTML pages, but I make extensive use
of the header 'BASE' tag and my CSS files always come through, so you may
want to consider that option.


html

head
...
base href=https://www.my-domain-name.com/my-web-app-name/;
link rel=stylesheet type=text/css href=asset/css/my.css
...
/head

body

...


Notice the trailing forward-slash in the BASE tag hyperlink reference. This
means that all other hyperlink references are stated as being relative to
that, and must NOT start with a leading forward-slash.

I specify the BASE tag using a custom tag that retrieves the base hyperlink
value from a context initialisation parameter (specified in the deployment
descriptor).

Using the BASE means that *all* my URL references are relative - and it has
not let me down yet.

Good luck!

Harry Mantheakis
London, UK



 
 Greetings fellow Tomcat dancers,
 
 Been losing cycles in a gumption trap, trying to hook a CSS file
 up to XSLT-generated XHTML pages. Many thanks to whomever sees
 my obvious error.
 
 If I hardwire the full-path filename of my development environment
 into the XSLT file, all works as hoped/planned/dreamed. But all
 other techniques I've tried fail.
 
 
 Tomcat: 5.0.19. Webapp name: nrd.
 
 WAR layout:
 
 |-nrd
   |-css/nrd.css
   |-images/
   |-Meta-inf/
   |-Web-inf/
 |-classes/
 |-dtd/
 |-lib/
 |-xsl/
 |-web.xml
 
 web.xml:
 
   web-app
 servlet
   servlet-name
 controller
   /servlet-name
   servlet-class
 org.apnp.nrd.ControlServlet
   /servlet-class
 /servlet
 
 servlet-mapping
   servlet-name
 controller
   /servlet-name
   url-pattern
 /*
   /url-pattern
 /servlet-mapping
   /web-app
 
 XSLT source that works:
 
   head
 meta http-equiv=Content-Type
   content=application/xhtml+xml; charset=utf-8/
   
 link rel=stylesheet type=text/css
   href=C:\Apache\Tomcat\Tomcat50\webapps\nrd\css\nrd.css/
   /head
 
 
 Versions of CSS href that do not work:
 
   href=css/nrd.css/
   href=/css/nrd.css/
   href=./css/nrd.css/
   href=nrd/css/nrd.css/
   href=/nrd/css/nrd.css/
   href=./nrd/css/nrd.css/
 
 
 I've also tried setting a global XSLT parameter:
 
 xsl:param name=rootDir select='../docroot'/
 
 and calling that:
 
 link rel=stylesheet type=text/css
   href={$rootDir}css/nrd.css/
 
 which results in a known unsuccesful link:
 
   href=/nrd/css/nrd.css
 
 
 Please, if you can, tell me what obvious thing I've missed.
 
 Thanks for any suggestions.
 
 
 Best wishes,
 
 William BC Crandall
 bc.crandall [around] earthlink.net
 
 
 -
 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]



Finding CSS files in webapp

2004-07-10 Thread William BC Crandall

Greetings fellow Tomcat dancers,

Been losing cycles in a gumption trap, trying to hook a CSS file 
up to XSLT-generated XHTML pages. Many thanks to whomever sees 
my obvious error.

If I hardwire the full-path filename of my development environment 
into the XSLT file, all works as hoped/planned/dreamed. But all 
other techniques I've tried fail. 


Tomcat: 5.0.19. Webapp name: nrd.

WAR layout:

  |-nrd
|-css/nrd.css
|-images/
|-Meta-inf/
|-Web-inf/
  |-classes/
  |-dtd/
  |-lib/
  |-xsl/
  |-web.xml

web.xml:

web-app
  servlet
servlet-name
  controller
/servlet-name
servlet-class
  org.apnp.nrd.ControlServlet
/servlet-class
  /servlet

  servlet-mapping
servlet-name
  controller
/servlet-name
url-pattern
  /*
/url-pattern
  /servlet-mapping
/web-app

XSLT source that works:

head
  meta http-equiv=Content-Type
content=application/xhtml+xml; charset=utf-8/

  link rel=stylesheet type=text/css
href=C:\Apache\Tomcat\Tomcat50\webapps\nrd\css\nrd.css/
/head


Versions of CSS href that do not work:

href=css/nrd.css/
href=/css/nrd.css/
href=./css/nrd.css/
href=nrd/css/nrd.css/
href=/nrd/css/nrd.css/
href=./nrd/css/nrd.css/


I've also tried setting a global XSLT parameter:

  xsl:param name=rootDir select='../docroot'/

and calling that:

  link rel=stylesheet type=text/css
href={$rootDir}css/nrd.css/

which results in a known unsuccesful link:

href=/nrd/css/nrd.css 


Please, if you can, tell me what obvious thing I've missed.

Thanks for any suggestions.


Best wishes,

William BC Crandall
bc.crandall [around] earthlink.net


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