Topic: XML-XSL form object formatting (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=21876" title="Pages that link to Topic: XML-XSL form object formatting (Page 1 of 1)" rel="nofollow" >Topic: XML-XSL form object formatting <span class="small">(Page 1 of 1)</span>\

 
Blaise
Nervous Wreck (II) Inmate

From:
Insane since: Jun 2003

posted posted 05-20-2004 12:42

Hi guys,

I'm a little bit green when it comes to XSL and I've got some code that I've got to tweak, can't really get my head round it so I thought I'd ask here.

Ok, I've got an XML document that looks something like this...

code:
<document xmlns:xf="http://apache.org/cocoon/jxforms/1.0">
<xf:form id="generic-refer" action="refer" method="GET">
<xf:group class="patientDetails">
<xf:label>Patient Details</xf:label>
<error>
<xf:violations class="error"/>
</error>
<xf:input ref="/title">
<xf:label>Title</xf:label>
<xf:violations class="error"/>
</xf:input>
<xf:input ref="/surname">
<xf:label>Surname</xf:label>
<xf:violations class="error"/>
</xf:input>
<xf:input ref="/firstname">
<xf:label>Firstname</xf:label>
<xf:violations class="error"/>
</xf:input>
</xf:group>
<xf:submit id="refer" continuation="foward" class="button">
<xf:label>Refer</xf:label>
<xf:hint>Click to refer</xf:hint>
</xf:submit>
</xf:form>
</document>

You can see here that it basically holds information about HTML form objects eg. input boxes, with their name and a label.

My XSL looks something like this...

code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xf="http://apache.org/cocoon/jxforms/1.0">
<xsl:output method="xml" omit-xml-declaration="no"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="xf:input">
<input name="{@ref}" type="text" value="{xf:value/text()}" class="refTbox">
<!-- copy all attributes from the original markup, except for "ref" -->
<xsl:copy-of select="@*[not(name()='ref')]"/>
<xsl:apply-templates select="xf:hint"/>
</input>
</xsl:template>
</xsl:stylesheet>

*phew!

Ok, so when I run this I get a list of my items, but I want is to display them in a table layout, instead of them all being rendered one after the other on teh page, is there a way to do this with the XSL?

Sorry if this question is vague but any help or guidance would be appreciated.

Cheers,

Blaise.

HZR
Bipolar (III) Inmate

From: Cold Sweden
Insane since: Jul 2002

posted posted 05-20-2004 20:05

Why aren't you using the TABLE element then?

(Edited by HZR on 05-20-2004 20:05)

Blaise
Nervous Wreck (II) Inmate

From:
Insane since: Jun 2003

posted posted 05-21-2004 11:06

Well the problem is I can't seem to add any formatting,

If you check the XML you can see that there is a tag called group, each group has it's own class as an attribute. a group consists of a load of input boxes, labels and maybe radio buttons etc basically form elements.

I want to write some XSL that will format those form elements into rows of two columns each, so two form elements to each row, if you get what I mean,

I was looking at using a for loop in XSL, but I can't work how to get it to do two at a time

Any ideas?



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu