|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Creating an input form, XML -> XSLT -> HTML
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
|
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
|

Cart








