xhtml

Get N characters introduction text with XSLT 1.0 from XHTML

半城伤御伤魂 提交于 2019-12-12 01:35:35
问题 How I can get first n characters with XSLT 1.0 from XHTML? I'm trying to create introduction text for news. Everything is UTF-8 HTML entity aware (   & ), one entity = one character HTML tag aware (adds missing end tags) Input HTML is always valid If input text is over n chars add '...' to end output Input tags are restricted to: a, img, p, div, span, b, strong Example input HTML: <img src="image.jpg" alt="">text <a href="http://domain.tld">link here</a> Example output with 9 characters: <img

quoting HTML attribute values

自古美人都是妖i 提交于 2019-12-12 01:34:44
问题 I know the spec allows both ' and " as delimiters for attribute values, and I also know it's a good practice to always quote. However I consider " being the cleaner way, maybe it's just me having grown up with C and C++' syntax. What is the cleanest way of quoting attribute values and why? Please no subjective answers. 回答1: Both are fine, but Double quotes are better (IMHO) as you reduce the risk of dynamic values causing errors. e.g. <input value='${lastName}'/> <input value='O'Graddy'/> ^^^

php vs htm, weird gaps

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 01:17:54
问题 the normal one: http://labvc.x10hosting.com/AT/site/home.htm VS the odd one: http://labvc.x10hosting.com/AT/site/home.php when i look at the code side by side, its almost identical, the only thing that would make them give that weird gap should be the CSS but they're using the same sheet. ideas? EDIT: I checked and made minute changes to the code, look again at the source. Both are EXACTLY the same. wtf is with this gap. EDIT: there's a pixel wide character just before the xml deceleration,

IE8, XHTML, position: fixed; and z-index

删除回忆录丶 提交于 2019-12-11 23:32:04
问题 I have an XHTML 1.0 transitional Doctype. I have a <div> that is position: fixed; bottom: 0px; left: 0px; width: 100%; z-index: 200; . Inside that <div> I have two buttons which are position relative, aligned right, with a set z-index of 201; In Firefox the bar at the bottom and the two buttons are correctly located at the bottom. In IE8 however, the bar is visible and the z-index appears to be overlaying the other content, but the buttons are hidden behind the main div, despite being

How to convert an html String to a PDF InputStream?

独自空忆成欢 提交于 2019-12-11 23:26:49
问题 If we have string with a content of a html page, how can we convert it to a InputStream made after transform this string to a pdf document? I'm trying to use iText with XMLWorkerHelper , and this following code works, but the problem is I don't want the output on a file. I have tried several variations in order to get the result on a InputStream that I could convert to a Primefaces StreamedContent but no success. How we can do it? Is there another technique that we can use to solve this

Replacing string in innerHTML

拈花ヽ惹草 提交于 2019-12-11 23:14:35
问题 So, this is a fairly simple thing I'm trying to accomplish (javascript), but it's taking me ages and it still does not work. I'm trying to replace certain words (that are within a pre tag). For example, the word "static" should be replaced by "<span class="keyword">static</span>" . I'm using XHTML strict. My approach is like this: for (var j = 0; j < keywords.length; j++) { codeBlock.innerHTML = codeBlock.innerHTML.replace(new RegExp(keywords[j], "g"), "<span class=\"keyword\">" + keywords[j]

Two <ul> and <br/> inside <div> is this OK to use?

给你一囗甜甜゛ 提交于 2019-12-11 22:16:48
问题 I have this horizontal list in XHTML: <div id="navcontainer"> <ul> <li><a href="#">Milk</a></li> <li><a href="#">Eggs</a></li> <li><a href="#">Cheese</a></li> </ul> <br/> <ul> <li><a href="#">Milk</a></li> <li><a href="#">Eggs</a></li> <li><a href="#">Cheese</a></li> </ul> </div> And the CSS file is this : #navcontainer ul { margin: 0; padding: 0; list-style-type: none; text-align: center; } #navcontainer ul li { display: inline; } #navcontainer ul li a { text-decoration: none; padding: .2em

How to add onChange function for all HTML form fields

纵饮孤独 提交于 2019-12-11 20:26:31
问题 My HTML Page has 10 Text Fields. Currently no onChange EVENT is available for all ten fields. <input type="text" name="text1" value="1"> <input type="text" name="text2" value="2"> <input type="text" name="text3" value="3"> <input type="text" name="text4" value=""> <input type="text" name="text5" value=""> <input type="text" name="text6" value="">... Now, I want to add onChange Function in all fields whose field is of input type. How do I add onChange or onBlur even in my JS section? In

resizable background image

流过昼夜 提交于 2019-12-11 19:59:22
问题 I have the following code but my image won't resize, how come? Does the image need to be bigger? <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>blah</title> <style type="text/css" media="screen, print, projection"> img#background { position: absolute; top: 0; left: 0; width: 100% height: 100%; } </style> </head> <body> <img id="background" src=

How can i check if every HTML tag is closed?

谁说我不能喝 提交于 2019-12-11 19:29:57
问题 i have this problem: user can add an HTML description and it will be shown on his profile; when i show the user list, i'd wish to show this description, too. since it could be too long, i'm going to cap it to a fixed lenght, but doing this i could break the HTML syntax leaving some tags open. how can i check if everthing is ok and, if needed, close any open tag? 回答1: @tampe125 This isn't my code, but it looks like it works. <?php /** * close all open xhtml tags at the end of the string * *