Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Basic question (I think!)

From: "Marrow" <m--a-r-r-o-w@--------------------.--->
To: NULL
Date: 10/1/2004 11:27:00 AM
Hi Alex,

>           <xsl:for-each select="NewDataSet/Table">

But there are no <NewDataSet> or <Table> elements in your XML??

Anyway, you have a default namespace in your XML - so you will need to
declare that in your stylesheet with an arbitrary namespace prefix so that
you can match/select against that namespace, e.g. with your example XML you
will need something like...

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:in="http://www.tempuri.org/Test.xsd">
  <xsl:template match="/">
    <HTML>
      <HEAD>
        <STYLE>
          <xsl:text>.HDR {
background-color:bisque;font-weight:bold }</xsl:text>
        </STYLE>
      </HEAD>
      <BODY>
        <TABLE>
          <COLGROUP WIDTH="100" ALIGN="LEFT"></COLGROUP>
          <TD CLASS="HDR">TestID</TD>
          <xsl:for-each select="in:DSTest/in:Test">
            <TR>
              <TD>
                <xsl:value-of select="in:TestID"/>
              </TD>
            </TR>
          </xsl:for-each>
        </TABLE>
      </BODY>
    </HTML>
  </xsl:template>
</xsl:stylesheet>


HTH
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator


"Alex Shirley" <postings@a...> wrote in message
news:e9704b08.0410010211.dcdac08@p......
> Hi
>
> Sorry for the basic question. I'm trying to work out here what I'm
> doing wrong. If I open the XML file (below) with the stylesheet
> (below) all I can see is the header (TestID) but no value (26).
>
> Where am I going wrong? I tried changing the select value of
> "<xsl:for-each select="NewDataSet/Table">", but could not get
> anywhere.
>
> Can someone please help? I'm sure it's something dumb (code below).
>
> Many thanks!!
>
> Alex!
>
>
> XSL style sheet------------>
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>   <xsl:template match="/">
>     <HTML>
>       <HEAD>
>         <STYLE>
>           .HDR { background-color:bisque;font-weight:bold }
>         </STYLE>
>       </HEAD>
>       <BODY>
>         <TABLE>
>           <COLGROUP WIDTH="100" ALIGN="LEFT"></COLGROUP>
>           <TD CLASS="HDR">TestID</TD>
>           <xsl:for-each select="NewDataSet/Table">
>             <TR>
>               <TD><xsl:value-of select="TestID"/></TD>
>             </TR>
>           </xsl:for-each>
>         </TABLE>
>       </BODY>
>     </HTML>
>   </xsl:template>
> </xsl:stylesheet>
>
> XML File---------->
>
> <?xml version='1.0'?><?xml-stylesheet type='text/xsl'
> href='Test.xsl'?>
> <DSTest xmlns="http://www.tempuri.org/Test.xsd">
>    <Test>
>       <TestID>26</TestID>
>    </Test>
> </DSTest>




transparent
Print
Mail
Like It
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.

.
.

transparent

transparent