Altova Mailing List Archives
>microsoft.public.xml Archive Home
>Thread Prev - Re: Element value is output even though it isnt in the XSL - why??? Surely this is impossible!
>Thread Next - Re: Element value is output even though it isnt in the XSL - why??? Surely this is impossible!
Re: Element value is output even though it isnt in the XSL - why??? Surely this is impossible!
Date: 10/21/2003 3:44:00 PM
Get hold of Marrowsoft Xselerator and run the XSLT in debug mode, you'll be shown which bits of the XML are being processed by *your* templates and which are being processed by the default templates (Hint: a big message says 'DEFAULT TEMPLATE' in red text). Cheers, Chris. "Paul" <removethisbitandtheunderscore_yaats@h...> wrote in message news:uLFyfl9lDHA.3700@T...... Thanks Chris, thats brilliant. I can now sleep easy knowing i hadn't gone completely potty! Chris Barber wrote: > Ahh, the bit I was looking for on W3C to says what the default > templates really are: > > http://www.w3.org/TR/xslt#built-in-rule > > Chris. > > "Chris Barber" <chris@b...> wrote in message > news:eYFlLZ8lDHA.2436@T...... > That'll be the default template operating on the following node: > > <REPORT_DATE>Date is: 20-Oct-2003</REPORT_DATE> > > Try putting this into your stylesheet to prevent default output for > text and attributes: > > <xsl:template match="text()|@*"> > <xsl:apply-templates/> > </xsl:template> > > Depending on how your stylesheet operates, I've usually found it > sufficient to just have: > > <xsl:template match="text()"> > <xsl:apply-templates/> > </xsl:template> > > And read this: > > http://tutorials.namesdirect.com/read/category/84/id/307 > > It's a real PITA at time but can be overridden easily enough. > > Chris. > > "Paul" <removethisbitandtheunderscore_yaats@h...> wrote in > message news:eUzfTm7lDHA.2772@T...... > I am trying to transform an XML document exported from some software > i have. I'd like this to be a nice and easy client side transform so > i have asked Internet Explorer to do the transform for me. > > This is the XML (note i changed the top line to point to the XSL i > wrote). > > <?xml-stylesheet href="x.xsl" type="text/xsl" ?> > <DATA> > > <REPORT_DATE>Date is: 20-Oct-2003</REPORT_DATE> > > <REPORT_RECORD> > <ADDRESS>www.blah.com</ADDRESS> > <IP_ADDRESS>18.104.22.168</IP_ADDRESS> > <OWNER>person</OWNER> > <ADDITIONAL_DATA> > <CREATED>19-Nov-1999</CREATED> > <UPDATED>11-Feb-2003</UPDATED> > </ADDITIONAL_DATA> > </REPORT_RECORD> > > <REPORT_RECORD> > <ADDRESS>www.xyzabc.com</ADDRESS> > <IP_ADDRESS>22.214.171.124</IP_ADDRESS> > <OWNER>blah</OWNER> > <ADDITIONAL_DATA> > <CREATED>01-Jan-2002</CREATED> > </ADDITIONAL_DATA> > </REPORT_RECORD> > > </DATA> > > > This is the XSL (x.xsl) > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > <xsl:template match="/"> > <html> > <head> > <title>Report</title> > </head> > <body> > <xsl:apply-templates/> > </body> > </html> > </xsl:template> > > <xsl:template match="REPORT_RECORD"> > <BR/> > <xsl:value-of select="ADDRESS"/>#### > <xsl:value-of select="IP_ADDRESS"/>#### > <xsl:value-of select="OWNER"/> > </xsl:template> > </xsl:stylesheet> > > > And this is the output that IE gives me: > > Date is: 20-Oct-2003 > www.blah.com#### 126.96.36.199#### person > www.xyzabc.com#### 188.8.131.52#### blah > > > Where does that top line come from?! I didnt tell it to print it! > I've messed about with the XSL but nothing works. Its as if IE is > confused somehow, but I tried it in Opera and thats the same as well. > > This is the article i based this work on (note how the authors XML > doesnt have an extra element and so he doesnt have that problem). > http://www.xml.com/pub/a/2003/02/05/tr.html > > Any ideas?? > > Thanks > > Paul