Hi, sandrat:
The "generic" answer is that XSLT defines a substring function. It's
not obvious from visiting Webhire's homepages what XML engine they are
relying upon, but presumably you are speaking for folks who are trying
to extract data from the Cyborg side and format it to suit the Webhire
requirements. I'll try to tackle your question from that angle.
XSLT is an XML-based standard for defining transformations of XML, in
particular from XML to XML (although it also can be used for XML to
text or XML to HTML). I have written a number of these transforms,
and most XML parsers now make it relatively easy to apply an XSLT (XSL
transformation) document to an XML input to produce the corresponding
output document.
The generic functionality is described here, in the W3C
recommendations for XPATH and XSLT:
[W3C: XPATH String Functions]
http://www.w3.org/TR/xpath#section-String-Functions
Given the specifics of your question, to extract the four digit
department number which precedes a hyphen (and surrounding spaces,
judging by your example), you might want to use the basic
substring(String,1,4) approach, or:
substring-before(String," -")
if there is doubt about the number of digits present.
The fact that you purchased Altova's XMLSpy (which I also own)
suggests that you may be working at the data massaging from a Windows
platform. One of the options with XMLSpy is to use the MSXML parser,
in which case you may be interested in the equivalent
Microsoft-specific documentation:
[MSXML String Functions]
http://msdn.microsoft.com/library/en-us/xmlsdk/htm/xpath_functions_91f7.asp
[MSXML substring]
http://msdn.microsoft.com/library/en-us/xmlsdk/htm/xpath_functions_5kq6.asp
[MSXML substring-before]
http://msdn.microsoft.com/library/en-us/xmlsdk/htm/xpath_functions_010u.asp
XMLSpy also permits you to directly apply an XSLT "transform" to an
XML document, for testing purposes as I see it, although it may suit
your environment to treat this as a production path. Their tutorial
describes the steps to perform this with the GUI interface in the
Chapter called XSL Transformation (although the example is XML to
HTML, the illustration should help):
[XMLSpy 2004 Tutorial (PDF)]
http://www.altova.com/documents/xmlspy2004proTutorial.pdf
regards, mathtalk-ga
Search Strategy
Keywords: W3C substring XSLT
://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=W3C+substring+XSLT&btnG=Google+Search
Keywords: MSXML substring XPath
://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=MSXML+substring+XPath&btnG=Google+Search
Keywords: XMLSpy apply transform site:altova.com
://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=XMLSpy+apply+transform+site%3Aaltova.com&btnG=Google+Search |