How do I replace quotes in XSLT with their HTML entities? - string

This is related to my previous question -" Manipulate the output of <xsl:apply-templates>".
I want to ask about the specific problem I am looking to address.
How do I replace quotes in XSLT with their HTML entities. I want to eventually pass it to Javascript variable with special characters escaped.

You may want to have a look at the Google code project xml2json-xslt, especially the xml2js.xslt template. Perhaps your answer lies in there.

Related

Internationalization Web Number-Symbols

do I need to use another number-symbols when I want my webpage to be accessible in other countries? According to Microsoft there are different shape of numbers: https://learn.microsoft.com/en-us/globalization/locale/number-formatting#:~:text=formatting%20for%20details.-,The%20character%20used%20as%20the%20thousands%20separator,thousands%20separator%20is%20a%20space.
I have been searching since a few days to get a clear answer but I cant find some. Also, on most international websites/apps I only ever see the digits 0,1,2,3,4,5,6,7,8,9 although the digits for the language actually look different. That unsettles me. I feel like many websites/apps just ignore this fact. Can anybody help me further? Also do I need to know how to activate foreign symbols in html?
I do not know for sure what language you are translating/typing in HTML. But here is an example of what you can use as a guide to certain scripts in Arabic: https://sites.psu.edu/symbolcodes/languages/mideast/arabic/arabicchart/
You may also need to use a converter. For example, I type Chinese on my website by typing the characters into a character to unicode converter. Then I copy and paste the unicode to my HTML text.

Markdown tabs in GitLab Markdown

I am writing documentation that has steps for Windows, Mac, Linux.
I want to make it look like this HTML5 tabbed HTML5 example
there is support for HTML in gitlab markdown
There is a reference to a sanitation class that validates the inline HTML in gitlab marrkdown
My question is:
Recommendations to achieve the tabbed documentation. Is there a workaround for displaying CSS correctly in markdown?
how to make this work?
Simply insert the relevant HTML/CSS/JS into your Markdown document.
As Markdown's Syntax Rules state (emphasis in original):
Markdown's syntax is intended for one purpose: to be used as a format
for writing for the web.
Markdown is not a replacement for HTML, or even close to it. Its
syntax is very small, corresponding only to a very small subset of
HTML tags. The idea is not to create a syntax that makes it easier
to insert HTML tags. In my opinion, HTML tags are already easy to
insert. The idea for Markdown is to make it easy to read, write, and
edit prose. HTML is a publishing format; Markdown is a writing
format. Thus, Markdown's formatting syntax only addresses issues that
can be conveyed in plain text.
For any markup that is not covered by Markdown's syntax, you simply
use HTML itself. There's no need to preface it or delimit it to
indicate that you're switching from Markdown to HTML; you just use
the tags.
The only restrictions are that block-level HTML elements -- e.g. <div>,
<table>, <pre>, <p>, etc. -- must be separated from surrounding
content by blank lines, and the start and end tags of the block should
not be indented with tabs or spaces. Markdown is smart enough not
to add extra (unwanted) <p> tags around HTML block-level tags.
However, there is one down side to this:
Note that Markdown formatting syntax is not processed within block-level
HTML tags. E.g., you can't use Markdown-style *emphasis* inside an
HTML block.
Finally, there is the concern that you appear to looking to have this document hosted on a third party site (perhaps in a readme on Gitlab). Most third party sites who process and host Markdown documents (including Gitlab) run the output through an HTML sanitizer for security reasons (to avoid XSS attaches, etc). Therefore, you are likely to find that various required hooks in your HTML will be stripped out and it won't work. Of course, this won't be a problem on your own site where you have total control.
The solution was tried in readme.rd from the text processor used by Microsoft VsCode and commited to gitlab. In the attached picture there is the rendering. It was not as expected. Perhaps the functionality to have tabs will be available soon.
An alternative is "collapsible sections" in GitLab Flavored Markdown. Link to documentation: link

How to write square brackets in markdown

I need to write in my gitlab project wiki page a code block that contains square brackets. Unfortunately the square brackets are turn into a link.
I assume gitlab is using markdown language or the gfm flavor.
This is my code:
```javascript
"{bla, """", [[foo],[]]}"
```
The foo],[ part is turn into a link. So basicaly I need a way to write a square brackets tah are not treated as a link. Surprisingly google doesn't provide any answer for such a trivial issue.
The current answer is that you can't do this. It is a know bug in GitLab, specifically in Wiki pages. GitLab markdown correctly handles square brackets in comments, and code blocks entered in issues, but NOT in wiki pages.
Please add your vote (thumbs up) on the issue to try and get it resolved:
https://gitlab.com/gitlab-org/gitlab-ce/issues/18725
Your (not very appealing) options boil down to these:
Use a single line code entry `"{bla, """", [[foo],[]]}"`
Use another syntax in your code block (e.g. {{), and include a note outside the code block saying to replace {{ with [[, etc - Note that you can use double brackets inside single quote blocks in GitLab Markdown.
Use a screenshot of your code.
None of these are very nice solutions, but all you have at the moment.

Skip $ character from normal text

This is very simple question but I unfortunately didn't get any clue to get rid from this error. I am writing a blog post about jquery ajax where I need to write a symbol $. I am using Mathjax for writing mathematical notation. As I write $ (for example $.getJSON), the Mathjax library decodes this as LaTeX commands. Anybody knows how to skip that $ character so that MathJax library behaves it as normal $?
By default, MathJax does not use the single dollar as a delimiter for in-line math (for exactly the reason you indicate), and so your configuration must be explicitly enabling it. See the text2jax dpcumentation for details of how this is done.
You have several options:
Remove the configuration that turns on dollar signs for in-line math. (This won't be good if you have already used them for in-line math in other posts)
Enable the processEscapes option so that you can use \$ to get a dollar without it being used as a math delimiter
If your blog allows you to enter raw HTML, you could use <span>$</span> to prevent MathJax from using the dollar as a delimiter (math can't contain HTML tags, so this dollar will not match up with another one, so won't be used as a delimiter).
Put your code examples inside <pre> or <code> containers, as MathJax (at least by default) doesn't process math within these. Your configuration may have changed that, however, so check the skipTags setting in your configuration.
Any of these should allow you to do what you need.

How to replace/remove specific strings from html file using Notepad++?

I've export my bookmarks from FF in to a html file but it's too huge and complicated, so I need to remove some firefox lines from it to make it more lighter and plain.
I can replace basic things in the Notepad++ but I guess I do need some operators for this and I have no idea how to make it work right.
For example here is the line from the file containing a link to Logodesignlove :
Logo Design Love
I need to remove all those tags I don't care about, like LAST_MODIFIED="1256428672", ICON_URI="bunch of digits" ICON="bunch of characters" etc.
And of course I need to remove all those tags in every link in the list.
So I was thinking like use something like "Find all tags LAST_MODIFIED="anynumbers" and replace it with nothing/remove it" - it doesn't work though.
Examle how it should like:
Logo Design Love
So far I removed LAST_MODIFIED and ADD_DATE lines thanks to Aleksandr. So LAST_MODIFIED="\d+" worked just fine. But ICON and ICON_URI are still there. I've tried ICON="\w+" - but it doesn't work. I guess it has something to do with the slashes.
Why look for what you don't want when it's easier to keep hold of what you do want and drop the junk?
(<A HREF=".*?").*?(>.*?>)
with
$1$2
Code edited to suit Notepad++ now I know it doesn't need the special chars escaped. Thanks Aleksandr.
Read up on using regular expressions (the java regex tutorials are a good start http://docs.oracle.com/javase/tutorial/essential/regex/), and try one of the online regex tools to help write and test it, such as this one http://gskinner.com/RegExr/
Eg, remove "LAST_MODIF..." with the regex LAST_MODIFIED="\d+"
Otherwise, you may want an XML-specific tool, or even write an XSL. However, I don't know much about that.

Resources