|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] I've modified my parser to copy attributes. Am I wrong?
Hey there. Due to a desire for simplicity and a dislike for the ugliness of xsl:attribute workarounds, I've changed the Parser I'm using (XML::XSLT) to allow formulations like: <xsl:template match="TextField" name="TextField"> <input type="Text"> <xsl:copy-of select="@" /> </input> </xsl:template> and <xsl:template match="Button" name="Button"> <input type="Button"> <xsl:for-each select="@"> <xsl:copy-of select="." /> </xsl:for-each> </input> </xsl:template> (XML below if you can't guess what I'm doing ;-) ) I note that an attribute isn't /really/ a first class element, and that the existing structure of XML::DOM doesn't encourage this sort of manipulation, but... is this approach spec-evil or what? I see nothing in the spec that forbids it I've seen several threads asking how to achieve this result, and to my mind, this is the obvious way of doing it. I know it can be done with half a page of xsl:attribute stuff, but whitespace keeps getting in the way if I format it, and my code looks like crap if I don't. Opinions all? .dan. -------------------------------------------------- XML: ---- <Button id="a_button" title="A Button Title" value="value for a button" /> <TextField id="a_TextField" title="A TextField Title" value="value for a TextField" /> | V XHTML: ------ <input type="Button" id="a_button" title="A Button Title" value="value for a button" /> <input type="Text" id="a_TextField" title="A TextField Title" value="value for a TextField" /> -- :=====================:====================: : Dan Morrison : The Web Limited : : http://here.is/dan : http://web.co.nz : : dman@xxxxxxxx : danm@xxxxxxxxx : : 04 384 1472 : 04 495 8250 : : 025 207 1140 : : :.....................:....................: : If ignorance is bliss, why aren't more people happy? :.........................................: 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








