Print TAB in JSTL - jstl

I have a simple question:
What's the equivalent of the following C statement in JSTL?
printf("\tHello");
I want to be able to include a TAB in the output. I know I can do:
<c:out value="Hello"/>
but that would not include a TAB before the word Hello. I tried &emsp as well, but with no success.

This works for me.
zzzz<c:out value=" Hello" escapeXml="false"/>zzzzz
and so does just
zzzz${" hellllo"}zzzz

Related

How to use substring() with Import.io?

I'm having some issues with XPath and import.io and I hope you'll be able to help me. :)
The html code:
<a href="page.php?var=12345">
For the moment, I manage to extract the content of the href ( page.php?var=12345 ) with this:
./td[3]/a[1]/#href
Though, I would like to just collect: 12345
substring might be the solution but it does not seem to work on import.io as I use it...
substring(./td[3]/a[1]/#href,13)
Any ideas of what the problem is?
Thank's a lot in advance!
Try using this for the xpath: (Have the field selected as Text)
.//*[#class='oeil']/a/#href
Then use this for your regex:
([^=]*)$
This will get you the ISBN number you are looking for.
import.io only support functions in XPath when they return a node list
Your path expression is fine, but perhaps it should be
substring(./td[3]/a[1]/#href,14)
"Does not seem to work" is not a very clear description of what is wrong. Do you get error messages? Is the output wrong? Do you have any code surrounding the path expression you could show?
You can use substring, but using substring-after() would be even better.
substring-after(/a/#href,'=')
assuming as input the tiny snippet you have shown:
<a href="page.php?var=12345"/>
will select
12345
and taking into account the structure of your input
substring-after(./td[3]/a[1]/#href,'=')
A leading . in a path expression selects only immediate child td nodes of the current context node. I trust you know what you are doing.

smarty concatanate a var from a file and a normal smarty one in the smarty include section

Hi I am trying to evaluate a variable from a file and a normal one but seems to be harder than it looks so :
This works:
{config_load file="archive_page.conf"
section="profile"} {include file="header.tpl" title=#pageTitle# keywords=#keywords# description=#description#}
I would like to also use my var and concatenate the text together so the below doesn't work also I have tried variations with '', "" but leads either an error message or one of the variables to display as text...
{config_load file="archive_page.conf"
section="profile"} {include file="header.tpl" title=#pageTitle#$MYVARHERE keywords=#keywords# description=#description#}
I tried various things but I can't get it to work, any help is much appreciated.
use the cat variable modifier:
title=#pageTitle#|cat:$MYVARHERE

View elements using javascript codes in vimperator?

I tried to use a command like this in Vimperator:
echo document.getElementsByTagName("p");
To view nodes whose tag name is <p> in vimperator. However, the result is like this:
I also tried the same command in Firebug. Following is the result:
While Vimperator's result is empty, Firebug's is not empty. Does anyone know why Vimperator echoes the Collection whose length is zero?
See the related question: How do I getElementByID in Vimperator?. The short answer is to use echo window.content.window.document.getElementsByTagName("p") instead.

How do I match a full link in capybara?

In Capybara+Rspec, I can check that a link is missing:
response.body.should_not have_link("link_content")
This is fine, but unfortunately the test fails for when "link_content" partially matches a link, such as "this_is_a_long_link_content". How can I change the test to make it pass in this case?
(That is, the matcher should not partially match, it should only fully match).
You can also use the following workaround:
response.body.should_not have_xpath("//a[normalize-space(text())='link_content']")
This is whitespace-agnostic and therefore a little more flexible than the raw HTML approach.
From the docs:
If all else fails, you can also use the page.html method to test against the raw HTML:
This works for me:
page.html.should match('>\s*Log in\s*</a>')
page.html.should_not match('>\s*link_content\s*</a>')
Note that the argument to match can a regular expression. That means that you can make the solution whitespace-agnostic by simply adding \s*.

Descendent-or-self in InfoPath

I want to use XPath code in an InfoPath form to sum the data in field12 when field11 is equal to IT. I tried using the following code, but it doesn't work.
number(sum(/descendant-or-self::node()/my:group12[my:field11 = "IT;"]/my:field12))
I suspect this has to do with the multilayering of groups, as shown below. Does anyone know the code that would allow me to get to the data in group12? Thanks in advance for your help.
myfields>group9>group10>group11>group12>field11 field12
Genipro
Looks like:
number(sum(/descendant-or-self::my:group12[my:field11 = 'IT;']/my:field12))
could be right.
decendant-or-self should not be necissary in this case (unless you need the expression to work even if group12 is moved).
This should work fine:
sum(/my:myfields/my:group9/my:group10/my:group11/my:group12[contains(my:field11,'IT')]/my:field12)
It doesn't matter if any of the other groups are repeating either. All group12's will be checked.

Resources