[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Using wildcards in xsl select

Posted on 2006-05-12
4
Medium Priority
?
1,467 Views
Last Modified: 2012-05-07
I am trying to create an XSL file that limits the output based on part of one field.  While I understand that you can do this using XML, I have yet to find exactly the correct syntax.  If someone could provide a link / sample code on how to do this, it would be greatly appreciated!

Thanks!
0
Comment
Question by:nwcc_seattle
  • 2
  • 2
4 Comments
 
LVL 26

Expert Comment

by:rdcpro
ID: 16671932
There are a lot of ways to accomplish this, but as an example, let's say you want an element that contains the first 5 characters in element myField:

<xsl:apply-templates select="/Some/Path/Here[contains(substring(myField, 1, 5))]"/>

You can make it case insensitive with the translate() function:

translate(myField, "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")

For a dynamic filtering and sorting example:

http://rdcpro.com/Members/rdcpro/snippets/filterandsort/

Regards,
Mike Sharp
0
 
LVL 1

Author Comment

by:nwcc_seattle
ID: 16684100
That looks great, but I am trying to do a hard code version (not based on what people type in)....   I;m trying to start simple with this.

the code I have so far is

<xsl:for-each select="xml element name goes here">
I know something relating to the contain function goes at the end, but I don't know what....

Any suggestions?

Thanks
0
 
LVL 26

Accepted Solution

by:
rdcpro earned 2000 total points
ID: 16684150
I guess I don't see what it is you're trying to accomplish.  You need to post some sample XML, and what you'd like to see output.  

If you can't post something specific (for whatever reason), I have tons of examples of various XML/XSLT on my site at http://rdcpro.com 

Regards,
Mike Sharp
0
 
LVL 1

Author Comment

by:nwcc_seattle
ID: 16809896
Worked great!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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, …
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 add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

830 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