Solved

XSL variable help -- not(contains(..  ?

Posted on 2014-10-03
7
148 Views
Last Modified: 2014-10-04
Hi,

   I have the following XSL below and its not quite right.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:variable name="mmname" select="normalize-space(attr[@tag='00081090'])"/>
 <xsl:template match="/dataset">
	<xsl:choose>
	  <xsl:when test="$mmname,not(contains('IntelliSpace PACS'))">
		 <destination aet="GINKGO_JH" priority="high"/>
	  </xsl:when>
	</xsl:choose>
 </xsl:template>
</xsl:stylesheet>

Open in new window


I know that there is something wrong when I'm calling the variable, but here is what I am wanting to accomplish.
When the variable $mmname does NOT contain 'IntelliSpace PACS' I want to do what is after the <xsl: when test>  I just don't know how to properly place eveything in the the '<xsl:when test' line.  Do I need an equals in between the variable or how would be the best way to go about this?

I can't tell it:  <xsl:when test!="$mmname='IntelliSpace PACS'"> because sometimes the last word changes.

What the variable is doing above is getting the value from the attr tag '00081090'

thanks
0
Comment
Question by:doc_jay
  • 5
  • 2
7 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 40360964
<xsl:when test="not(contains($mmname, 'IntelliSpace PACS'))">
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 40360965
contains is a function that takes two argumenst, like shown above
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 40360966
You have not shown us the XML but

<xsl:variable name="mmname" select="normalize-space(attr[@tag='00081090'])"/>
conflicts with
<xsl:template match="/dataset">

the root is either "attr" or "dataset" but not both

I guess (without seeing the source XML) that you need
<xsl:variable name="mmname" select="normalize-space(//attr[@tag='00081090'])"/>
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:doc_jay
ID: 40361369
Yes, your right.  showing all of the XML would  make a lot of difference.  I apologize!

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:variable name="mmname" select="normalize-space(attr[@tag='00081090'])"/>
 <xsl:template match="/dataset">
	  </xsl:if> -->
	<xsl:choose>
	  <xsl:when test="$mmname,not(contains('IntelliSpace PACS'))">
		 <destination aet="GINKGO_JH" priority="high"/>
	  </xsl:when>
	</xsl:choose>
 </xsl:template>
</xsl:stylesheet>

Open in new window

0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 40361390
I actually meant the source XML :-)
the XSLT was clear to me

did you try the two suggested changes? It should work
0
 

Author Comment

by:doc_jay
ID: 40361391
Just tried it out and yes, it compiled great this time!  thank you
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 40361422
welcome
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question