How to convert a xml element into url using css?
Tags: css,xml
Problem :
I have an xml file which has an element like this
<video><title>XXXX</title><url>VIDEO ID OF YOUTUBE></url></video>
Is there any way to use CSS to display the elements as
<a href="http://www.youtube.com/videoid">XXXX</a>
Solution :
I do not know of a way to use CSS for this. But you can do this using a XSLT Stylesheet. Is that what you want? Then a XSLT Stylesheet similar to this can help you:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="html" indent="yes"/>
<xsl:template match="/" >
<body>
<xsl:apply-templates select ="/items/video"/>
</body>
</xsl:template>
<xsl:template match="video" >
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="./url" disable-output-escaping="yes" />
</xsl:attribute>
<xsl:value-of select="./title"/>
</a>
</li>
</xsl:template>
<xsl:template match=
"*[not(@*|*|comment()|processing-instruction())
and normalize-space()=''
]"/>
<xsl:template match="text()"/>
</xsl:stylesheet>
This assumes that the XML input file looks as follows:
<?xml version="1.0" encoding="utf-8" ?>
<items>
<video>
<title>XXXX</title>
<url>VIDEO ID OF YOUTUBE></url>
</video>
<video>
<title>XXXX</title>
<url>VIDEO ID OF YOUTUBE></url>
</video>
</items>
Exactly how you should do the transform is hard to say when I don't know about your requirements. A XSLT transform can be done in a number of ways. If the XML input file is static one can let the webbrowser do the transformation. If the XML file is on a server you can write a transform in a awebpage and sen the HTML to the webbbrowser. It all depens on your environment.
CSS Howto..
You can use clone helper to clone element on drag start and append it to the body with appendTo option: $("#draggable_1").draggable({ helper: 'clone', appendTo: 'body', start: function(e){ $(this).css('visibility', 'hidden'); },...
It might be a little hacky but you could always apply the transition to your div on click as well. Did this pretty quick but it works. Check out the...
Although i could not replicate your total example but i have a set up a small working code which displays image on top when u click bottom image this could...
You can do this by simply floating the elements. CSS .box{ border: 1px solid #333; padding: 14px 27px 10px 15px; min-height: 60px; min-width: 60px; } .box .text-one{ display: block; text-align:...
One of the tricky things in modern web design is to create a two (or more) column layout where all the columns are of equal height. I set out on...
Depending on which selector engine you use, you can: add a class to your exception h1 element you can use the :not selector to only apply cufon to the h1's...
add box-sizing: border-box; to your divs. If you don't the padding is added outside the div width (or height).. same as borders Edited: and -webkit-box-sizing: border-box; -moz-box-sizing: border-box; for a...
You could use CSS3 transform skewY() function with positive value for the parent and negative value for the child wrapper element to achieve the effect. .parent { -webkit-transform: skewY(-5deg); -moz-transform:...
Technique I had to use pseudo-element as described by @Alex Bell. But instead of box-shadow I use text-shadow and tweak the pseudo-element position. pseudo-element text is ˍ aka U+02CD MODIFIER...
I've resolve this problem. Escape the colons to make it work: select:\:\-ms-expand { display: none; } ...
This finds all elements with text-align: justify and sets the border to red. It should be plenty to get you started. Note: This is not very efficient, but there's not...
When clicking on the submit button, check the fields before you let the user continue, and if they are incorrect, return false; so the submit button won't refresh the page....
It's because div's are displayed as block by default. To fix your issue add display: inline-block to the div's containing select. Add below code to your CSS. .profileField .select{ display:...
I hope you'll find this answer to be both simple and pixel-perfect. .stripe { background-color: #B7B7B7; height: 13vh; } .whiteThing { background-color: white; height: 13vh; width: 13vh; border-radius:0 50% 50%...
You can dynamically add or remove disabled="disabled" from any hidden field to make its tabindex value ignored. $("a:hidden").attr("disabled","disabled"); ...
If you want reset ALL CSS properties, you can do it. It is big file, probbably not best solution, but it works. .yourContainer * { -webkit-align-content: stretch; -moz-align-content: stretch; align-content:...
You can use @media queries to get device resolution or screen position and apply css updates based on that. Example Or you can use bootstrap. Here is an example. Change...
Here is the solution .green-circle { color: green; border: 2px solid green; border-radius: 100%; height: 200px; width: 200px; position: relative; } .red-circle { color: red; border: 2px solid red; border-radius:...
If you look at some of the examples you can see they are linking css and js files <link href="http://code.ionicframework.com/1.0.0-beta.6/css/ionic.css" rel="stylesheet"> <script src="http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js"> That would be the bext option. If...
I tried it buddy i almost got solution. .parent:hover + .child{ background-color:violet; } just add this css and you will get change in both div when u focus on parent...
Your first question can be answered by removing the default margin-bottom for the class navbar: .navbar { margin-bottom:0 } Now, for your second question. There is a triangle created using...
Finally jsfiddle is up. I forked your fiddle and updated the HTML, CSS and added some jQuery. There are several ways to implement what you're trying to do here. Once...
I used moredemons's answer as a basis, using CSS triangles. It does the same thing, but it properly separates the CSS so you don't have to edit the JS to...
Try this Need space between two classes. <input type="button" class="class1 class2" /> CSS .class1{ // class1 css } .class2{ //class2 css } ...
I set a width on both elements as well as the wrapper <h1>, to make sure they would float next to each other and there would be no text underneath...
You can give position absolute for the input : <input type='text' style="z-index:999;position: absolute;top: 50px;left: 67px;"> Fiddle : http://jsfiddle.net/Cv9DM/3/...
You're looking for min-width. div{ width:50%; /* Your dynamic width */ min-width:300px; /* The narrowest the element can be */ } http://jsfiddle.net/ejbSd/...
You could use vertical-align: top; to override default vertical-align value that is baseline. figure.red { vertical-align: top; } Fiddle: http://jsfiddle.net/ytn6z8oo/1/...
Use CSS3's :not() selector (which has an equivalent jQuery selector): img:not(#thisone) { } If you need better browser support, there's always the fact that ID selectors, being the most specific...
Place this inside of your CSS file: @font-face { font-family: 'your font name'; src: url(path/to/your/font.woff); } .anyClassToUseFont { font-family: 'your font name' } Make sure the path to the .woff...