What does <var name="ROMAN"> mean in xsl - xslt

I am really facing a strange problem. ROMAN characters are not displaying at all in mozilla and google chrome except on IE8(not in IE10 as well).
The code was written using xsl transformations. and i am unable to find what does
<var name="ROMAN"> is? This is the exact text when i see the html source.
Even the same code is written in xsl.
Any help would be greatly appreciable.

<var> is an HTML element that means "This is a variable". It will typically cause the contained text to be rendered in italic. It doesn't mean anything special to XSLT, it's just like any other HTML element name. name="ROMAN" is just like the name attribute of any other HTML element, it can be used in Javascript to address the relevant element node in the page. It doesn't change the rendition of the element, unless perhaps there is some stylesheet somewhere that recognizes name="ROMAN" and associates it with a display style.
I think you've got an HTML question, not an XSLT question. There's something wrong with your HTML, and we don't know what, because you haven't given enough information.

Related

Drupal 8 Webform: how to display text input on one page on the next page?

I am trying to develop a multistep webform in Drupal 8 using Webform 8.x-5.1. I have written a WebformHandler that extends Drupal\webform\Plugin\WebformHandlerBase and made it available to the webform.
In the first step of the webform, I collect a text-field. I would like to display the value of that text-field in an HTML element (Advanced HTML/Text or Basic HTML) on the second page after doing some computation.
I have overwritten submitForm() in the WebformHandler and in it assign the value I want to the HTML element as follows:
$form['elements']['page_name']
['advanced_html_element']['#text'] = '...my HTML...';
Using ksm() I can see that this assignment works, but the the HTML element is not rendered with my HTML: the element is either invisible or contains the initial value set up in the form editor.
Clearly I'm missing something. Should I be using something other than submitForm? Can anyone help me?
It's been a long haul, but I've finally worked out how to do what I want to. The following works for me.
Firstly, I discovered the method validateForm in WebformHandlerBase. On each page in a form with multiple pages, you will find that the following methods are called in the order given here:
submitForm (called once)
alterForm(called possibly more than once)
validateForm (called once)
The name validateForm leads me to believe I may be misusing this method, but that is where I set up the elements on the following page that I wish to programmatically initialise. It works, so what the hey!
In validateForm, I initialise the elements that appear on the following page as follows:
$form_state->setValue(<element name>, <data structure>);
The <element name> is the name you give the element in the form editor ("Build" tab). The <data structure> has to be correct, of course: I suggest you find the appropriate structure by first filling in the element on the next page manually and seeing what turns up in $form_state.
There is also a $form_state->getValue(<element name>), which seems to me to mean that $form_state can also be used for storing session data, say in hidden fields. I initially used Drupal::service('tempstore.private')->get('xxx') for storing data that had to be available across page boundaries, but $form_state might be a cleaner solution.
I hope this helps someone: I spent a horribly long time trying to get this to work.

TrimDuplicates element of Microsoft.Search.Query Webservice causes a FormatException

I'm trying to search through a site collection and find all sites that contain a particular file. TrimDuplicates is supposed to be the right way to do that. I'm calling QueryEx of the WebService object with the following XML as the string argument.
<QueryPacket xmlns='urn:Microsoft.Search.Query'>
<Query>
<TrimDuplicates includeid="false">False</TrimDuplicates>
<SupportedFormats>
<Format revision='1'>urn:Microsoft.Search.Response.Document:Document</Format>
</SupportedFormats>
<Context>
<QueryText language='en-us' type='STRING'>
"filenameForQuery"
</QueryText>
</Context>
</Query>
</QueryPacket>
The response from search.asmx is a 500 error with System.FormatException as the only piece of useful information.
It's only the TrimDuplicates element that is triggering the formatexception. Fiddling the case of the two Falses hasn't had any effect so far.
The answer is actually blindingly obvious - remove the includeid attribute and make the content of TrimDuplicates lower case.
Just wanted to point out that includeid should actually be an integer value.
More here
But as you said, it's not necessary.

Can XSLT be used to apply CSS styles?

I have some XML and a very small XSLT to convert that into HTML. When I import my XML content in InDesign using the XSLT, I can see the styles are applied to the elements on the left hand browsing side but, when I drag and drop the elements in the InDesign frames, nothing is happening. The content is flowing normally.
My question is, in InDesign, is XSLT getting used only for sequencing the elements or can we use XSLT to apply the styles (like font-size, line-spacing etc.) as well for elements?
Also, if you can send me any sample XSLT for converting an XML to HTML tags or any example, that will be great.
In general, formatting in InDesign has nothing in common with CSS styles -- that is a HTML construction, not an XML one. You can indeed only reorder elements (and other element-wise stuff, such as removing, replacing, or adding tags).
Formatting can be applied to the tags after you imported/translated your XML using Map Styles To Tags (or Map Tags to Styles; I don't think I've ever used either).
You can use HTML within XLST so, if you have something like:
<xsl:value-of select="node"/>
Then this can also be written like:
<div class='style'><xsl:value-of select="node"/></div>
Or you can use inline CSS like:
<div style='color:red;'><xsl:value-of select="node"/></div>
Hope this helps!

How to: use a querystring parameter in Sharepoint Search XSL?

This is my very first attempt at dealing with XSL, so please be kind :)
I am modifying the SharePoint 2010 peoplesearch results page - specifically the "View in Organizational Browser" line. I have added the orgbrowser webpart to our main site and don't want to direct users to the mysite for this link.
Here is the modified code:
<a id="{concat($currentId, '_OrgBrowserLink')}" href="/search/pages/orgbrowser.aspx?accountname={string(accountname)}">ยป <xsl:value-of select="$ViewHiearchyLabel" /></a>
The above code works fine. I find I am having problems adding the search results querystring parameter though. The parameter is "k".
I find I cannot append the "&" symbol (due to it being a special reserved character most likely). I have tried "%26" but that seems to mess up the accountname parameter before it (I receive a 'user not found' correlation ID error)
I cannot seem to grab the querystring parameter "k" with my limited knowledge of how xsl works. Could someone enlighten me?
Thanks all
Unfortunately, the People Search Results web part does not pass the current url as a parameter. It does, however, pass several other URL parameters that do contain the current query string. So the solution is to use one of those, parse out the value in the 'k' parameter and append it to the URL.
I used the $NameSortUrl XSL parameter.
I parsed out the value of the 'k' parameter by using the substring-before and substring-after functions and saving the value in a variable:
<xsl:variable name="kVal" select="substring-before(substring-after($NameSortUrl, 'k='), '&')"/>
I then appended this value to the url like this:
<a id="{concat($currentId, '_OrgBrowserLink')}" href="/search/pages/orgbrowser.aspx?accountname={string(accountname)}&k={$kVal}">
Note the use of HTML encoding to get the ampersand in the url (&).
Hopefully this is useful to someone else in the future.

Truncate text formatted via HTML with XSLT 1.0

I am trying to truncate some text that has been formatted via HTML, but I need to keep the html in tact. I am doing so in SharePoint 2007 - so I am using XSLT 1.0.
I found this bit of XSLT here: http://symphony-cms.com/download/xslt-utilities/view/20816/
I was able to implement it, but it is telling me that the variable or parameter "Limit" has been defined twice.
However, the author has named many variables and parameters "Limit" and I am not sure which one I need to change.
I am fairly new to XSLT, and any help is greatly appreciated.
This is because at the top the XSLT the author has defined limit as a parameter
<xsl:param name="limit"/>
But a few lines down, then defines it as a variable
<xsl:variable name="limit">
Perhaps he had a 'buggy' xslt processor which allowed variables to be re-defined, but it should not actually be valid.
I did try renaming the variable to newlimit but it is hard to know whn he subsequently refers to limit whether it is the paramater or variable it is referring too (I couldn't actually get it to output useful HTML).
You are probably better off looking for something else to meet your needs. There may even be similar questions here on StackOverflow if you search about. For example, perhaps this meets your needs
XSLT - Using substring with copy-of to preserve inner HTML tags
I am sure there may be others if you look. If not, feel free to ask a new question, giving your input HTML, and your expected output, so that it is clear what your requirements are.