RE: [xsl] Accessing file properties

Subject: RE: [xsl] Accessing file properties
From: "Wei, Alice J." <ajwei@xxxxxxxxxxx>
Date: Sat, 26 Jan 2008 22:47:44 -0500
Hi, Sean:

  Sadly, XSLT has no search and replace functions of arguments like Perl. If
you want, you can write a little program in Perl, and tell it to search for
your <file name="WORD_DOC_NAME"> string, and use a substring function to
replace it with your intended file name.

  What you can do, if you do have a lot of WORD_DOC_NAME that you want to
replace at once, you can use this little recipe:

Returns a string that is created by replacing the given pattern with the
replace argument

Example: replace("Bella Italia", "l", "*")
Result: 'Be**a Ita*ia'
Example: replace("Bella Italia", "l", "")
Result: 'Bea Itaia'

This is taken from the W3 Schools site, or you can look at
There are also some discussion on replace() on Michael Kay's XPath.

<xsl:template match="file">
<xsl:when test="contains(@name,'WORD_FILE_DOC')">
<xsl:value-of select="replace(@name,'FILE','NEW')">
<xsl:value-of select=".">

Good luck!

 Alice Wei
 MIS 2008
 School of Library and Information Science
 Indiana University Bloomington

-----Original Message-----
From: Sean Tiley [mailto:sean.tiley@xxxxxxxxx]
Sent: Saturday, January 26, 2008 9:56 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Accessing file properties

Hi Alice,
Yes, I want to output the document name in my resulting xml file which
looks like the following

    <file name="WORD_DOC_NAME">
                <test case="TC-01" result="FAIL" date="2008-01-25"
                <test case="TC-02" result="FAIL" date="2008-01-25"
                <test case="TC-03" result="FAIL" date="2008-01-25"
                <test case="TC-04" result="PASS" date="2008-01-25"/>
                <test case="TC-01" result="PASS" date="2008-01-26"/>
                <test case="TC-02" result="PASS" date="2008-01-26"/>
                <test case="TC-03" result="FAIL" date="2008-01-26"
                <test case="TC-04" result="PASS" date="2008-01-26"/>
                <test case="TC-05" result="PASS" date="2008-01-26"/>
                <test case="TC-06" result="FAIL" date="2008-01-26"

I wish to replace "WORD_DOC_NAME" with the file name


Current Thread