Solved

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

Posted on 2014-10-03
7
147 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
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 …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now