tags:

views:

55

answers:

3

I am writing a Page with XML Only. No XSL is being. everything is going well with XML and CSS. But how can I make Input fields with XML and CSS Only ?? is it really possible ??

A: 

Xml is for data transformation, porting, trasportation, etc - things related to data.

CSS is for styling.

You will need something for instance, html(or XForms?), to provide/render controls.

Or probably, if you plan to render the control yourself, then you can, for instance, add an element, and render the control by parsing it yourself.

<MyControl type="Text">This is a test value</MyControl>

When you see MyControl having a Text type then add a Text control.

--EDIT--

This is in response to your comment.

I understand what you are saying; to be clear, I believe CSS by nature/actually is for styling - therefore CSS is applied "on" the controls, CSS aren't the controls; so we come up with certain classes, ids, selectors and apply them over the controls.

This may be, yet again, a fat example, but its like telling a "Paint" to build a "House".

Probably you already know this, but this is just to add: Following is how CSS is applied to a html button control. Example taken from here:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS Button</title>
<style type="text/css">
body {
  font: 140%/1.6 "Gill Sans", Futura, "Lucida Grande", Geneva, sans-serif;
  color: #666;
  background: #fff;
}

a:link, a:visited {
  display: block;
  width: 6em;  
  padding: 0.2em;
  line-height: 1.4;
  background-color: #94B8E9;
  border: 1px solid black;
  color: #000;
  text-decoration: none;
  text-align: center;
}

a:hover {
 background-color: #369;
 color: #fff;
}

</style>
</head>

<body>

<p><a href="#">Button</a></p>

</body>
</html>

The above code is going to render a button with css applied like following: alt text

So to answer your question directly, I believe it is not possible to render a control with CSS.

Now based upon your requirements, I understand that: 1. You want to render the control yourself. 2. You want to apply CSS to that control.

Solution 1: 1. Add, parse and render your custom control xml tags, as discussed earlier. 2. And add the CSS style within xml, see example

Solution 2: 1. Add, parse and render your custom control xml tags, as discussed earlier. 2. Add css in xml CDATA; while xml parse, grab the CSS from CDATA, and apply to the control.

KMan
I want to use My own Custom XML Tag. But I want to know is there any CSS Property that can make the browser believe that the following node should be drawn as a input field.Thanks
@User: Please see my edit, in response to your comment.
KMan
A: 

I don't believe you can use just CSS to create controls.

However..

If you don't mind expanding to use something else, I would suggest using XForms. It works very well with XML, and it uses CSS for styling.

The following are links to some guides, tutorials, and articles to get you started:

http://en.wikibooks.org/wiki/XForms

http://w3schools.com/xforms/default.asp

http://www.ibm.com/developerworks/xml/library/x-xformsfirefox/

http://www.ibm.com/developerworks/library/x-xformswhy.html

Hope this helps!

developer
I could use XForms if it was 2012 or latter.Still now XForms are not Entertained in most widely used Browser
A: 

CSS can style XML, but browsers are inconsistent concerning semantics.

For example, something like:

<Link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="..." /> 

Will make a working link in Firefox, but doesn't work in Safari. ( I think it also worked in IE, but I tried it a long time ago, so I could be wrong. I also tried using <xhtml:a ...> , which I think also worked in some but not other browsers. Perhaps there's a way to do this in javascript. )

So: there's not even a portable way to get link behavior in CSS styled XML. I don't think input fields are possible at all. Doing xslt transforms to html in the browser is much more portable. You might also look at XForms -- although no browsers support that natively either.

Steven D. Majewski
Yah Still Now Using XML leaves you in the desert of compatibility issues in Browsers. and also Javascript Frameworks will not operate on XML Nodes either. also taking events from XML Nodes are Impossible (I Think). I need to do `<xhtml:span onclick="fnc">` to take an onclick event.`<do:landingTime xhtml:onclick="fnc">20:48:29.45</do:landingTime>` doesn't seem to work even. I'd be very very glad to know if it works in any popular browser of this Planet