Subject: RE: Something like position()
From: cknell@xxxxxxxxxx
Date: Wed, 28 Mar 2007 12:59:49 -0400
|
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*" />
<xsl:output method="xml" indent="yes" encoding="UTF-8" />
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="fields">
<form>
<xsl:apply-templates select="field[preceding-sibling::field[@name='name']][following-sibling::field[@name='favFood']]" />
</form>
</xsl:template>
<xsl:template match="field">
<xsl:copy-of select="." />
</xsl:template>
</xsl:stylesheet>
--
Charles Knell
cknell@xxxxxxxxxx - email
-----Original Message-----
From: Steve <subsume@xxxxxxxxx>
Sent: Wed, 28 Mar 2007 12:49:52 -0400
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Something like position()
I'm making an xsl template which takes a SQL table's info and
automates form display based on data types, field order, etc.
Given something like
<fields>
<field name="name" />
<field name="city" />
<field name="state" />
<field name="zip" />
<field name="favFood" />
</fields>
---
Above, I'd like only the nodes which are after @name="city" and before
@name="favFood".
Let's say, for example, I wanted to add zipPlusFour after "zip" and
before "favFood". I'd want my xsl to 'know' to this field belongs in
the form. Looking for output something like...
<form>
<city>
<state>
<zip>
</form>
-Steve
|