xsl-list
[Top] [All Lists]

Re: [xsl] Newbie cannot find syntax error in attribute select

2011-02-16 02:58:25
On 16/02/2011 03:14, thehulk(_at_)comcast(_dot_)net wrote:
Hello,

I am trying to transform "Account" elements into "Contract" elements which contain some of the data 
in the "Account" element. I want to make the Sub-Id into an attribute of the Contract, taking it from an 
attribute of an element within the Account element. (I also get the Org-Id from one of the "Characteristic" 
elements within the Account, which works fine. I thought that would be the hard part!)

I am using Eclipse 3.6.1 and performing the transform with the "Run" menu. My processor 
is the "jaxp" plugin.

My (bad) template is:

<xsl:template match="Account_or_Subaccount">
   <xsl:element name="Contract">
     <xsl:attribute name="Sub_ID">
       <xsl:value-of select="./Subscriber_Info@Sub_Id" />
     </xsl:attribute>
     <xsl:attribute name="Org_ID">
       <xsl:value-of select="./Characteristic[@Display_Lable=&quot;Organization 
ID&quot;]" />
     </xsl:attribute>
   </xsl:element>
</xsl:template>

The error is the missing "/" before "@Sub_Id".

But why all this turgid code? the whole thing can be written as

<xsl:template match="Account_or_Subaccount">
  <Contract Sub_ID="{Subscriber_Info/@Sub_Id}"
            Org_ID="{Characteristic[@Display_Lable='Organization ID']}" />
</xsl:template>

[is "Lable" spelt correctly??]


Michael Kay
Saxonica




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--