RE: Sorting attributes with XSL - Is there a way to "grep" and ma tch on partial attribute string value?

Subject: RE: Sorting attributes with XSL - Is there a way to "grep" and ma tch on partial attribute string value?
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Wed, 22 Sep 1999 17:43:53 -0600
> I want to match attribute string value for 
> HL71A/MSH/PID/@Name NOT as exact match as follows:
> 
> <xsl:apply-templates select="HL7A1/MSH/PID[@Name = 
> 'Donneley^Floyd']" order-by = "+@Name" />
> 
> Instead, what I want to do is sort @Name and match for all 
> @Name attribute values where @Name starts with D or d (or any 
> other letter) and would retrieve all attribute values which 
> start with D or and then populate the table.

You seem to be using the syntax for the IE5 implementation of the December
working draft, so the answer is no, because you don't have access to
substrings and thus can't test the first letter of the Name attributes
(unless there is some JScript/DOM trick someone can elaborate on).


Using the current XSLT and XPath syntax, it should be something like this:

<xsl:apply-templates select="HL7A1/MSH/PID[starts-with(@Name,'D') or
starts-with(@Name,'d')]">
    <xsl:sort select="@Name"/>
</xsl:apply-templates>


...which means:

"Apply the templates that match the following set of nodes:
  PID elements that are:
    (children of MSH elements that are
      children of HL7A1 elements that are
        children of the current node),
  and that have:
    (a Name attribute that starts with 'D' or
     a Name attribute that starts with 'd').

 Instead of looking at this set of nodes in document order,
 look at the set in ascending order according to the string
 value of the Name attribute of each node."


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


Current Thread