Re: xsl-list Digest 23 Jun 2007 05:10:01 -0000 Issue 1
hi Michael, thanks for the reply. for added info though, the second xml with the <addressFieldn> was such because it came from an input element whose name is dynamically set. then the "n" or the number after addressField is an id that i'll be using to reference that addressField on my database. i'm not sure if i explained it right but to give you a better idea, i'm gonna need to have a form that dynamically changes the address fields depending on the country selected. so total address fields will really vary on what is set for a particular country. (some has streets+town+postal code, others have flat+bldg+territory, etc). i'll try both your codes and your suggestion on the xml design still. i'll see if i can get a work around to arriving at what you suggested. i'll keep you posted. big thanks! -ycon > ------------------------------ > > Date: Fri, 22 Jun 2007 10:20:56 +0100 > To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> > From: "Michael Kay" <mike@xxxxxxxxxxxx> > Subject: RE: Concatenation of Element Values > Message-ID: <008c01c7b4ae$a3f0b980$6701a8c0@turtle> > > Sorry, the ../* is wrong, it's looking relative to > ID rather than to > ADDRESS. The right answer depends on exactly where > your <addressField1> etc > elements are. > > Michael Kay > http://www.saxonica.com/ > > > > > <xsl:template match="ADDRESS"> > > <xsl:for-each select="ADDRESSFIELD/ID"> > > <xsl:value-of > select="../*[name()=concat('addressField', > > current())"/> > > <xsl:if test="position()!=last()">;</xsl:if> > > </xsl:for-each> > > </xsl:template> > > > > (I'm assuming here that addressField2, etc, are > siblings of > > ADDRESS, but you didn't make this clear). > > > > Incidentally, coding data into element names like > this feels > > like bad XML design. <addressField id="2"> would > be much > > cleaner than <addressField2>. > > > > Michael Kay > > http://www.saxonica.com/ > > ____________________________________________________________________________________ [expletive deleted]-punch spam with award-winning protection. Try the free Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/features_spam.html
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format