It would be useful to be able to get relative URLs for
navigation in the generated HTML output. I think that
setting baseURL to the empty string should give you
that.
The problem with this is that I currently force the file://
url in some places -- it wasn't as easy to change as I
thought. Do you consider this as important? If yes -- raise
the priority again.
Thanks,
PeterB
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Given that the double slash bug is fixed, it's not very
important. But it's considered a good practice to use
relative URL on web pages whereever possible.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I took a look at this again and it is even harder than I
thought. The problem is that it is easy to go down, but how
do I go up? Example: you are on the page
sectionA/index.html but I have to load the image for a
pageX in sectionB, which would
be ../sectionB/imageForPageX.png. This means I would have
to either change the @src attribute for all files/images
when changing the directory or it would be a task for XSLT
to compare two absolute directories to turn a link into a
relative one.
Doing the trick in XSLT might be not too hard, //entry
[@active='true']/@src gives you the url for the current
entry, when comparing this to the target @src one could
first delete the common start in the target, count the
number of slashes in the current url behind the common part
and then add as many "../" before the target. Maybe I try
this in the generic stylesheet, solving the problem on the
Java side seems too complex (although directories are not
changed that often and a hashtable could collect all
relevant @src attribute nodes).
Maybe next time I look at this request ;-)
PS: and there is always wget to help you if you really need
relative urls ;-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately it is not that easy. If you have two sections
using the subdirectories "dirA" and "dirB", all links from
within dirA will point to "./dirB/something" instead
of "../dirB/something". For each nesting of sections one
has to add a "../" in front of the URL.
Maybe there is a neat trick to calculate this string in
XSLT by looking at the number of <section> ancestors of the
<entry> where [@active='true'] and then replacing the
single dot with n times "../", where n is the number of
these ancenstors (should correlate 1:1). Would produce
weird links for files in the same directory (going up and
then down the same path) but should work.
Solving this in XWeb itself would mean changing the urls of
all entries in the navigation tree whenever the directory
changes. I guess this should be implemented some day, but I
consider other things as more important at the moment, so I
will focus on other things, although it shouldn't be too
hard to implement. I accept patches ;-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=41603
The problem with this is that I currently force the file://
url in some places -- it wasn't as easy to change as I
thought. Do you consider this as important? If yes -- raise
the priority again.
Thanks,
PeterB
Logged In: YES
user_id=92749
Given that the double slash bug is fixed, it's not very
important. But it's considered a good practice to use
relative URL on web pages whereever possible.
Logged In: YES
user_id=41603
I took a look at this again and it is even harder than I
thought. The problem is that it is easy to go down, but how
do I go up? Example: you are on the page
sectionA/index.html but I have to load the image for a
pageX in sectionB, which would
be ../sectionB/imageForPageX.png. This means I would have
to either change the @src attribute for all files/images
when changing the directory or it would be a task for XSLT
to compare two absolute directories to turn a link into a
relative one.
Doing the trick in XSLT might be not too hard, //entry
[@active='true']/@src gives you the url for the current
entry, when comparing this to the target @src one could
first delete the common start in the target, count the
number of slashes in the current url behind the common part
and then add as many "../" before the target. Maybe I try
this in the generic stylesheet, solving the problem on the
Java side seems too complex (although directories are not
changed that often and a hashtable could collect all
relevant @src attribute nodes).
Maybe next time I look at this request ;-)
PS: and there is always wget to help you if you really need
relative urls ;-)
Logged In: YES
user_id=332825
There is a workaround if you don't need any relative urls:
set basename to "." (only dot), this will reference the
actual directory.
Logged In: YES
user_id=41603
Unfortunately it is not that easy. If you have two sections
using the subdirectories "dirA" and "dirB", all links from
within dirA will point to "./dirB/something" instead
of "../dirB/something". For each nesting of sections one
has to add a "../" in front of the URL.
Maybe there is a neat trick to calculate this string in
XSLT by looking at the number of <section> ancestors of the
<entry> where [@active='true'] and then replacing the
single dot with n times "../", where n is the number of
these ancenstors (should correlate 1:1). Would produce
weird links for files in the same directory (going up and
then down the same path) but should work.
Solving this in XWeb itself would mean changing the urls of
all entries in the navigation tree whenever the directory
changes. I guess this should be implemented some day, but I
consider other things as more important at the moment, so I
will focus on other things, although it shouldn't be too
hard to implement. I accept patches ;-)