Subject: [xsl] could someone tell me if this makes sense From: Michael Case <mecase@xxxxxxxxxxx> Date: Tue, 20 Feb 2001 17:06:39 -0800 |
Hi, I have two simple (I hope) questions. The following xslt works (i.e. does what I want) using testXSLT of XALAN 1.0 (C++ version). The first question I have is about the xsl:text and the way I use it in the snippet below. i.e. to just put the spaces and lf where i want them. Does this snippet conform to all existing standards? If I sent the whole thing to someone using another xsml/xslt processor, would they get the same results. I ask this because of things I have read on the list regarding whitespace, plain text, etc. This is my second attempt at making an XSL transform, and I'm not sure if I'm violating any major principles or the standard in trying to extract plain text (not tagged at all) from an XML document. The second question is about repeated attributes. I chose to make the opts attributes because I wanted them to come out on one line and I couln't get it to do so as an element. After looking at what I was doing, there was really no need for the opts to be an element anyway (as far as I can tell right now from what I'm trying to accomplish). Is there a simple Xpath wildcard way to say I want all opt* to come out here? So, here is the stuff: want: <do id1="3" id2="fred" opt1="-3" opt2="1" opt3="qzyvx"><comment>blah</comment> <comment>blah too</comment> to come out some form of text here: 3 fred -3 1 qzyvx blah blah too <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/xhtml1/strict" version="1.0"> <xsl:output omit-xml-declaration="yes" method="text"/> <xsl:preserve-space elements="*"/> <xsl:template match="do"> <xsl:text> </xsl:text> <xsl:text>some form of text here:</xsl:text> <xsl:value-of select="@id1"/> <xsl:text> </xsl:text> <xsl:value-of select="@id2"/> <xsl:text> </xsl:text> <xsl:value-of select="@opt1"/> <xsl:text> </xsl:text> <xsl:value-of select="@opt2"/> <xsl:text> </xsl:text> <xsl:value-of select="@opt3"/> <xsl:text> </xsl:text> <xsl:value-of select="@opt4"/> <xsl:apply-templates/> </xsl:template> <xsl:template match="comment"> <xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet> Thanks for any comments. Sincerely, Michael Case -- Michael E. Case UC Davis case@xxxxxxxxxxxxxxxxxx (530) 754-7226 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] [ANN] XSLT tutorial, Henning Behme | Thread | The top 10 limitations of XSLT 1.0 , Andrew Kimball |
Re: [xsl] tutorial xml to xml using, Robert Koberg | Date | The top 10 limitations of XSLT 1.0 , Andrew Kimball |
Month |