xsl-list
[Top] [All Lists]

RE: [xsl] chekcing attribute existance from a string

2006-05-01 01:43:58
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(_at_)gmail(_dot_)com] 
Sent: 01 May 2006 00:22
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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[(_at_)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[(_at_)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

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>