[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Creating an input form, XML -> XSLT -> HTML

Subject: Re: Creating an input form, XML -> XSLT -> HTML
From: Ron King <roncking@xxxxxxxx>
Date: Sun, 30 Dec 2001 11:20:49 -0600
jobpositionseeker
I found an example in the archives dated 17 Oct 1999 23:49:15 from Clark Evans.
The example is supposed to handle attributes as well as elements, but given
this input:

<JobPositionSeeker status = "active">
 <JobPositionSeekerId>JaneDoe2000-06-01-LOR1235</JobPositionSeekerId>
 <Supplier>
  <SupplierId idOwner = "LotsOfResumes.com">LOR1235</SupplierId>
  <SupplierName>LotsOfResumes.com</SupplierName>
  <Contact>
   <PersonName>
    <FormattedName type = "presentation">Bob Smith</FormattedName>
   </PersonName>
(OTHER INPUT TRUNCATED)


It produces this output:

/JobPositionSeeker[0001]
 /JobPositionSeeker[0001]/JobPositionSeekerId[0001]JaneDoe2000-06-01-LOR1235
 /JobPositionSeeker[0001]/Supplier[0001]
  /JobPositionSeeker[0001]/Supplier[0001]/SupplierId[0001]LOR1235
  /JobPositionSeeker[0001]/Supplier[0001]/SupplierName[0001]LotsOfResumes.com
  /JobPositionSeeker[0001]/Supplier[0001]/Contact[0001]
   /JobPositionSeeker[0001]/Supplier[0001]/Contact[0001]/PersonName[0001]

/JobPositionSeeker[0001]/Supplier[0001]/Contact[0001]/PersonName[0001]/FormattedName[0001]Bob
Smith

(OTHER OUTPUT TRUNCATED)

The attributes status, idowner and presentation aren't in the output! How can I
get those too?

Regards,

Ron




Trevor Nash wrote:

> Ron King <roncking@xxxxxxxx> wrote:
>
> >How can I get a string representing the path in xslt?
>
> If you look back in the archives of this list you will find references
> to general ways of doing this for any node.  I don't remember where
> exactly.  You will also find it useful to look at the FAQ and
> www.jenitennison.com, http://www.bayes.co.uk/xml among others.
>
> If the document isn't huge or performance isn't particularly an issue,
> and if its always an element you are after, then a simple approach is
> to generate something of the form "//*[n]" which you can do with:
>  concat('//*[', concat(count(preceeding::*|ancestor-or-self::*), ']')
> (I didn't test that, if it is wrong I am sure someone will correct me
> ;-)
> This is intended as a hint to get you started, not a complete
> solution.
>
> ><xsl:text disable-output-escaping="yes"> First Name: <![CDATA[<]]>input
> >type="text" name="</xsl:text><xsl:value-of
> >select="generate-id()"/><xsl:text>" value="</xsl:text><xsl:value-of
> >select="GivenName"/><xsl:text disable-output-escaping="yes">"> </xsl:text>
> >
>
> Others have already pointed out the 'right' way to do this.  If you
> are not sure why your attempt is wrong (other than readability) try
> putting the result of the transformation into a DOM instead of a file.
>
> You might worry about the / in <input ... /> in the answers you have
> been given, which is not legal HTML.  Don't.  The XSLT processor will
> look after this for you.
>
> Out of curiosity: how did you arrive at your disable-output-escaping
> solution?  What resources did you use?  Is there a web site out there
> somewhere with examples like this?  A magazine article maybe?
>
> I know there are others who listen to this list who are also XSLT
> trainers, and may be interested in your answer.
>
> I hope you have not paid for any XSLT trainng or advice - if you have,
> you were robbed ;-)
>
> Regards,
> Trevor Nash
> --
> Traditional training & distance learning,
> Consultancy by email
>
> Melvaig Software Engineering Limited
> voice:     +44 (0) 1445 771 271
> email:     tcn@xxxxxxxxxxxxx
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.