Altova Mailing List Archives


RE: [xsl] Really basic, but can't get it to work, and it's getting on my nerves::*

From: "Michael Kay" <mhkay@------------>
To:
Date: 7/3/2001 8:39:00 AM
select="cs:@id" should be select="@cs:id"

Mike Kay
Software AG

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of 
> Daniel Newman
> Sent: 03 July 2001 16:36
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] Really basic, but can't get it to work, and it's
> getting on my nerves::*
> 
> 
> OK then boys. I keep getting an EOF error whenever I try to 
> reference an
> attribute. How can I get the following value?
> 
> <xsl:template match="cs:ScripCommsMessage" >
> 	<xsl:apply-templates select="cs:SearchForHolderResponse" />
> </xsl:template>
> 
> <xsl:template match="cs:SearchForHolderResponse" >
> 	<table cellpadding="2" cellspacing="0">
> 		<xsl:for-each select="cs:Items/cs:Item">
> 			<xsl:call-template name="GetTableData" />
> 		</xsl:for-each>
> 	</table>
> </xsl:template>
> 
> <xsl:template name="GetTableData">
>     <tr>
>       <xsl:call-template name="GenerateRowColor">
> 	  <xsl:with-param name="Index" select="cs:@id" /> 
> <------  @id is returning
> Expected token 'eof' found
>       </xsl:call-template>
>       <td width="4%" valign="top">
> 		<font face="Arial, Helvetica, sans-serif" 
> size="2"><xsl:value-of
> select="cs:@id" /></font>
>       </td>
>       <td colspan="2" valign="top">
> 		<font face="Arial, Helvetica, sans-serif" size="2">
> 		<a 
> href="/xml_interface/HolderInfo.asp?id={cs:HIN}" class="HolderSearch">
> 			<xsl:value-of select="cs:NameAddress1" />
> 		</a><br/>
>         	<xsl:value-of select="cs:NameAddress3" /></font>
>       </td>
>       <td width="16%" nowrap="true" valign="top">
> 		<font face="Arial, Helvetica, sans-serif" 
> size="2"><xsl:value-of
> select="cs:HIN" /></font>
>       </td>
>     </tr>
> </xsl:template>
> 
> 
> 
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Chris Bayes
> Sent: 03 July 2001 16:03
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] Really basic, but can't get it to work, and it's
> getting on my nerves::*
> 
> 
> That is probably because it is hitting all the default templates.
> I missed the namespace first time around. Change your stylesheet to
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:x="http://www.computershare.com/scripcomms/v1.0"
>  >
> <xsl:output method="html" indent="yes" />
> <xsl:include href="CommonFunctions.xsl" />
> 
> <xsl:template match="x:ScripCommsMessage">
> 	<b><xsl:value-of select="x:HostSlot" /></b>
> 	<xsl:apply-templates select="x:SearchForHolderResponse" />
> </xsl:template>
> 
> <xsl:template match="x:SearchForHolderResponse" >
> 	<xsl:value-of select="x:FirstRecordHandle" />
> 	<xsl:for-each select="x:Items/x:Item">
> 		<xsl:call-template name="GetTableData" />
> 	</xsl:for-each>
> </xsl:template>
> </xsl:stylesheet>
> 
> Ciao Chris
> 
> XML/XSL Portal
> http://www.bayes.co.uk/xml
> 
> 
> >-----Original Message-----
> >From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of 
> Daniel Newman
> >Sent: 03 July 2001 15:48
> >To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >Subject: RE: [xsl] Really basic, but can't get it to work, and it's
> >getting on my nerves::*
> >
> >
> >Thanks Chris, but this is how I had it to start with. For 
> some reason, I
> >just get::
> >
> >1417010A10A000002000100880A000002000100C0072995945M60 
> 1AASMITH & WILLIAMSON
> >NOMINEES<A/C A164>,12 POINT STREETSPITTAL
> >ESTATESANDLODGEMANCHESTERG0200328400EC2A 1BRSMITH & WILLIAMSON
> >NOMINEESLIMITED <CH>,10 ACACIA AVENUEHUTTINGDON 
> HILLLONDONC0072996089M60
> >1AASMITH & WILLIAMSON NOMINEES<A/C M22>,12 POINT STREETSPITTAL
> >ESTATESANDLODGEMANCHESTERC0072996135M60 1AASMITH & 
> WILLIAMSON NOMINEES<A/C
> >P270>,12 POINT STREETSPITTAL 
> ESTATESANDLODGEMANCHESTERC0072990390M60 1AAMRS
> >A SMITH12 POINT STREETSPITTAL 
> ESTATESANDLODGEMANCHESTERC0072990528M60 1AAMR
> >ALBERT CARLTON SMITH12 POINT STREETSPITTAL
> >ESTATESANDLODGEMANCHESTERC0072990625M60 1AAMR ALEXANDER 
> WILLIAM SMITH12
> >POINT STREETSPITTAL ESTATESANDLODGEMANCHESTERC0076921946AUSMRS ANGELA
> >WARDLEY SMITHC/O COMPUTERSHARE LIMITED18-62 TRENERRY
> >CRESCENTABBOTSFORDVICTORIA 3067AUSTRALIAC0072990838M60 1AAMR 
> ANTHONY LLOYD
> >BOND-SMITH +M/S PETRONELLA ELIZABETHBOND-SMITH,12 POINT STREETSPITTAL
> >ESTATESANDLODGEMANCHESTERC0072990927M60 1AAMR BARRY ALAN 
> SMITH12 POINT
> >STREETSPITTAL ESTATESANDLODGEMANCHESTER
> >
> >But, If I save all the XML except for the <ScripCommsMessage
> >xmlns="http://www.computershare.com/scripcomms/v1.0">, it 
> works a treat. So
> >this is what I'm going to have to do. Rehash the external 
> file and convert
> >it into something without a named namespace!
> >
> >Thanks anyway.
> >
> >Daniel.
> >
> >-----Original Message-----
> >From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of 
> Chris Bayes
> >Sent: 03 July 2001 15:39
> >To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >Subject: RE: [xsl] Really basic, but can't get it to work, and it's
> >getting on my nerves::*
> >
> >
> >Daniel
> >
> >
> >>OK,
> >>
> >>here's one for the beginners;
> >>
> >>I've got the following XML <slightly modified>
> >>
> >><ScripCommsMessage 
> xmlns="http://www.computershare.com/scripcomms/v1.0">
> >>	<HostSlot>1479</HostSlot>
> >>	<SearchForHolderResponse>
> >>		<Result>0</Result>
> >>		<NoOfItems>10</NoOfItems>
> >>		<FirstRecordHandle>A10A000002000100</FirstRecordHandle>
> >>		<RecordHandle>880A000002000100</RecordHandle>
> >>		<Items>
> >>			<Item id="1">
> >>				<HIN>C0072995945</HIN>
> >>				<PostCode>M60 1AA</PostCode>
> >>				<NameAddress1>SMITH &amp;
> >>WILLIAMSON NOMINEES</NameAddress1>
> >>				<NameAddress2>&lt;A/C
> >>A164&gt;,</NameAddress2>
> >>				<NameAddress3>12 POINT 
> STREET</NameAddress3>
> >>				<NameAddress4>SPITTAL 
> ESTATE</NameAddress4>
> >>				<NameAddress5>SANDLODGE</NameAddress5>
> >>				<NameAddress6>MANCHESTER</NameAddress6>
> >>				<NameAddress7/>
> >>			</Item>
> >>		</Items>
> >>	</SearchForHolderResponse>
> >></ScripCommsMessage>
> >>
> >>
> >>And this is the start of my XSL:
> >>
> >><xsl:stylesheet version="1.0"
> >>xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> >><xsl:include href="CommonFunctions.xsl" />
> >><xsl:output method="html" />
> >><xsl:output indent="yes" />
> >
> >this should be
> ><xsl:output method="html" indent="yes" />
> >
> >>
> >><xsl:template match="/">
> >
> >this is matching the root not ScripCommsMessage as HostSlot 
> is not a child
> >of the root you get nothing there
> >change it to /ScripCommsMessage
> >
> >>	<b><xsl:value-of select="HostSlot" /></b>
> >>	<xsl:apply-templates select="/SearchForHolderResponse" />
> >></xsl:template>
> >
> >this is saying apply-templates to the top level element
> >SearchForHolderResponse which is not a child of the root you 
> get nothing
> >there
> >remove the leading "/"
> >
> >>
> >><xsl:template match="SearchForHolderResponse" >
> >
> >this never gets hit because of the above apply-templates
> >
> >
> >>	<xsl:value-of select="FirstRecordHandle" />
> >>	<xsl:for-each select="Items/Item">
> >>		<xsl:call-template name="GetTableData" />
> >>	</xsl:for-each>
> >></xsl:template>
> >></xsl:stylesheet>
> >
> >Ciao Chris
> >
> >XML/XSL Portal
> >http://www.bayes.co.uk/xml
> >
> >
> > XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
> >
> > XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
> >
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

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.