Solved

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

Posted on 2014-10-03
7
144 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
Comment Utility
<xsl:when test="not(contains($mmname, 'IntelliSpace PACS'))">
0
 
LVL 60

Expert Comment

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

Expert Comment

by:Geert Bormans
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:doc_jay
Comment Utility
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
Comment Utility
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
Comment Utility
Just tried it out and yes, it compiled great this time!  thank you
0
 
LVL 60

Expert Comment

by:Geert Bormans
Comment Utility
welcome
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 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

7 Experts available now in Live!

Get 1:1 Help Now