[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: chekcing attribute existance from a string

Subject: RE: chekcing attribute existance from a string
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 1 May 2006 09:43:35 +0100
RE:  chekcing attribute existance from a string
Given that you have a list of all the attribute names, your logic should be
something like:

<xsl:for-each select="$possibleAttributes">
  <td>
  <xsl:choose>
    <xsl:when test="row/@*[name()=current()]">
       <xsl:value-of select="row/@*[name()=current()]"/>
    </xsl:when>
    <xsl:otherwise>
       <xsl:text>(blank)</xsl:text> 

> -----Original Message-----
> From: jd list [mailto:jdlists@xxxxxxxxx] 
> Sent: 01 May 2006 00:22
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  chekcing attribute existance from a string
> 
> Hi.  This is likely a common issue, but can't seem to find 
> the right search terms to find assistance.
> 
> I'm trying to make a simple web page where a user can view a 
> html version of our xml config file.I have a set of 
> attributes in a particular node, not all of which are 
> required by the xsd and there are many of these nodes for 
> each parent node.
> 
> What i would like to do, for display, is get the list of all 
> possible attributes (done) and show those as a header (done), 
> and then display each node attributes as a table row, and 
> when i get to a node that only has a subset of the 
> attributes, skip any attribute that does not exist
> 
> the repeating nodes look like:
> <tag tag_type="timewave" integrate="aa" high_pass="0" interval="600"
> tag_id="707" comment="comment comment comment">
> 
> in this case i would want headers of
> tag_type integrate high_pass interval tag_id comment
> 
> in later rows that do not have a high_pass, for example how 
> do i skip that column.  i have all headers in
> 
> /path/to/tag[@tag_type='overall'][1]/@*
> 
> and was thinking of foreaching thoguht that same set to get 
> the others and trying a when 
> test="/path/to/tag/var[@var_id=$varId]/../../tag/name()".  
> where $varId is a variable from a higher level. the name() 
> portion is obviously illegal, but it illustrates what i'm 
> trying to do.  I want to check for the existance of an 
> attribute based on the result of name(), from the header list 
> and skip the column and move to the next.
> 
> Thanks for any assistance.  sorry so wordy....
> Jeff

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.