Altova Mailing List Archives


Re: Element value is output even though it isnt in the XSL - why??? Surely this is impossible!

From: "Chris Barber" <chris@----------.--.--.------>
To: NULL
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>1.2.3.4</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>5.6.7.8</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#### 1.2.3.4#### person
> www.xyzabc.com#### 5.6.7.8#### 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



Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.