Riddle with "href" - href

Mysticism.
I use XSLT for reception of the address for the reference.
<a href="{element/url}"/>
In XML i have:
<element>
<url>www.mysite.ru</url>
</element>
As a result on page I receive:
<a href="www.currentsite.ru/cursection/cursubsection/www.mysite.ru"/>
That is: in the beginning there is an address of a current site (the address of current section where we now are), and then there is a reference to an external site.
There can be it any problem with metatag BASE?
In what a trouble?

Most likely the URL you see is what is interpeted by the browser as the final URL .. in the source code it most likely is as you want it ...
in HTML, the hrefs if they do not start with a protocol (http, ftp, mailto ..etc) then they are interpeted as relative urls.. which means relative to where the current url is..
either change the
<a href="{element/url}"/> to <a href="http://{element/url}"/>
or the
<element>
<url>www.mysite.ru</url>
</element>
to
<element>
<url>http://www.mysite.ru</url>
</element>

<url>www.mysite.ru</url>
Ceci n'est pas une URL.
That's a hostname. If you want to turn it into an absolute URL you will have to add http:// to the front. Otherwise, as a relative URI in href, it's just a pointer to the file called www.mysite, with file extension .ru, in the current folder.

Related

How to get SSI variable REQUEST_URI without query parameters

I'm trying to get the pathname part of the REQUEST_URI, without the query parameters. I need to do this in raw SSI, without any PHP or anything.
If I do something like <!--#echo var="REQUEST_URI" -->, that will output the pathname plus the query parameters, so if the browser URL shows http://example.com/foo.html?bar, that would return /foo.html?bar. But I need to return only /foo.html. Is there a way to do that directly inside an echo statement?
Note: It needs to use the requested uri only. The actual file paths on the server are very different and I cannot display those.
I don't have a running nginx with SSI around, so i am just guessing here.
But maybe you can try to use a regular expression to extract what you want.
Maybe something like this:
<!--# if expr="$REQUEST_URI = /(.+)\?.*/" -->
<!--# echo var="1" -->
<!--# endif -->
I am not sure about the \ before the ?.
You could try to use the DOCUMENT_URI variable instead:
<!--#echo var="DOCUMENT_URI" -->
SCRIPT_NAME seems to work too:
<!--#echo var="SCRIPT_NAME" -->
This code works for me :
<!--#if expr="$REQUEST_URI = /([^?]+)\?.*/" -->
<!--#set var="URL_WITHOUT_QUERY_STRING" value="$1" -->
<!--#echo var='URL_WITHOUT_QUERY_STRING' -->
<!--#endif -->

relative URL seems to be interpreted incorrectly by the browser

I have a relative URL on a page, which is being interpreted relative to the root (instead of relative to the current doc). Can't figure out why.
On page:
http://vm:8080/docs
There is a tag:
<a rel="nofollow" href="_sources/index.txt">Show Source</a>
The browser resolves this to:
http://vm:8080/_sources/index.txt
Instead of:
http://vm:8080/docs/_sources/index.txt
Here is some information for the anchor from the DOM.
origin http://vm:8080
baseURI http://vm:8080/docs
pathname /_sources/index.txt
href http://sanjay-vm:8080/_sources/index.txt
Why is the browser adding a leading slash to the pathname?

how to get value of field with space in xsl file

Creating an ItemStyle XSL file for content query Webpart, i want to get value from the Pages library that inherits from Article Pages. this is OK with title or fields with no space. However, i seems not to work with field containing space, its display name is Article Date. I did try the following code:
<xsl:value-of select="#Article Date" />
Could you tell me, how could i do in such case? should i call external name of this field inside xsl file, like or other ways?
According to this page, the internal name for "Article Date" is ArticleStartDate. Try using that instead, and you may have more success.
<xsl:value-of select="#ArticleStartDate" />

DocuSign API: Pre-filling radio group tabs for template

I have radio groups setup in my DocuSign template, and am trying to fill it up while creating an envelope using the template. Here's the XML structure that I've made:
<envelopeDefinition xmlns="http://www.docusign.com/restapi">
<accountId>******</accountId>
<status>sent</status>
<templateId>******</templateId>
<templateRoles>
<templateRole>
<email>******#test.com</email>
<name>****** ******</name>
<roleName>General</roleName>
<clientUserId>UserId</clientUserId>
<tabs>
<textTabs>
<text>
<tabLabel>Name</tabLabel>
<value>Test User</value>
</text>
<text>
<tabLabel>Address 1</tabLabel>
<value>123 Main Street</value>
</text>
<text>
<tabLabel>Address 2</tabLabel>
<value>Venice, CA 12345</value>
</text>
</textTabs>
<radioGroupTabs>
<radioGroup>
<groupName>Radio Group 1</groupName>
<radios>
<radio>
<selected>True</selected>
<value>Radio 1</value>
</radio>
<radio>
<selected>False</selected>
<value>Radio 2</value>
</radio>
</radios>
</radioGroup>
</radioGroupTabs>
</tabs>
</templateRole>
</templateRoles>
</envelopeDefinition>
Is this XML request correct? The 'Name' and 'Address *' tabs are correctly filled, but the radio group tabs are not filled at all.
Your XML looks correct to me; in fact, I was able to copy/paste (including the radioGroupTabs portion) from your code sample into my own request and it works as desired -- i.e., the radio button specified as selected in the request is indeed selected when the recipient opens the envelope.
I'd suggest you verify that the values of groupName and value (for each Radio) in the Request XML match exactly with the corresponding values specified for the Radio Button Tag Properties, as shown here in the DocuSign UI -- and keep in mind that values are case-sensitive:

Flask import static resources

The problem: I get a 404 when I access static resources from any route other than '/'.
I have an image called volume.png in my static folder in my Flask application. When I route my main page to '/' using #app.route('/') it finds the image fine, and I can display the image when I hit localhost:5000/static/images/volume.png. But when I use any other link, for example, '/s', it says it can't find the image in s/static/images/volume.png. Even when I create an s directory and copy the static directory to it, I get a 404 when I type localhost:5000/s/static/images/volume.png. I've considered using Flask-Assets, but there doesn't appear to be much documentation or examples. What's a good way to make sure my routes have access to the static resources?
You need to qualify the path to your image in your HTML (or CSS):
<!-- This will break in the way you describe -->
<img src="static/images/volume.png" />
<!-- This will not -->
<img src="/static/images/volume.png" />
<!-- Nor will this (assuming you are using a Jinja template) -->
<img src="{{ url_for('static', filename='images/volume.png') }}" />
The reason for this is because of the way that user-agents are required to resolve relative paths for URIs (see section 5.1 of RFC 3968 for the details).
Using static/images/volume.png results in the following path at /:
scheme://host.name/static/images/volume.png
and the following at /s:
scheme://host.name/s/static/images/volume.png
as you have discovered. By ensuring that you provide an absolute path component (at the very least) for your resources, you ensure that the browser will merge your provided path with only scheme and host.name, rather than with scheme, host.name and path.