Solved

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

Posted on 2014-10-03
7
152 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
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 Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

733 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