xsl-list
[Top] [All Lists]

Re: Input form from schema - indexable parameter

2004-01-19 05:39:33
Dear David,

thanks for the reply, but I should explain myself better!

My xsd file (input to the transformation) will 1st be scanned for element declarations. Maybe like this one, which would require two text fields on an HTML form as input:

<xsd:element name="MyComplexElement_1">
<xsd:complexType>
<xsd:sequence>
  <xsd:element name="subEl1" type="xsd:string"/>
  <xsd:element name="subEl2" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

It will stick all the ones it finds into a single variable (like a list). Basically I want the first pass to say "I see that this is a complex type DECLARATION, I'll put it in the "'multiVariable" variable. Then later, on the second pass when the processor encounters a particular instance or reference to one of my complex types, it will be able to look up the multiVariable-variable, to pull out the value appropriate to this type using syntax something lilke:

 <xsl:value-of select="multiVariable['MyComplexElement_3']">

or

 <xsl:value-of select="multiVariable[count]"> (within a looping template)
 <!--Check the name here-->

I know it's not really an array, but it's array-ish syntax. I want "multiVariable" to hold a list of things that I can get at by either a name or an index number. I can't seem to create this variable - if I am creating it I'm certainly not accessing it properly!


From: David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Input form from schema - indexable parameter
Date: Mon, 19 Jan 2004 11:44:59 GMT

  Needed is an example of how to store and retrieve data in an indexable
  parameter.  I would like to create "myTypes" as an indexable array of
  variables

xslt does not have arrays so I am having trouble guessing exactly what
you want here, but if you want a variable that stores structured data
(as appears to be the case) then you want to use a node set, possibly
(or possibly not) in a nodeset-valued variable.

eg if the document x.x.ml
<x>
<a/>
<b/>
<c/>
</x>

corresponds to your "array" then

<xsl:copy-of select="document('x.xml')/x/*[2]"/>

will access the second element of that "array".

David
`
--
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>