 |
| XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 20th, 2008, 02:31 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
You're doing something wrong, but without seeing more of your code there's no way we can tell where your mistakes lie. Tell us exactly what you did and exactly how it failed.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|

June 22nd, 2008, 09:55 PM
|
|
Authorized User
|
|
Join Date: Jun 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I tried to extract a value (eg: employeeID) from a text node which has lot other information (like employee name, dept, designation, etc.). Is there a way to search for a particular string in a text node?
I faced something strange the other day. I was able to save the XML response on the client's local drive but when I opened it, I found some of the namespaces were replaced by ns1, ns2, etc. What I think is - Apache Axis is appending its own namespaces. So, how to clean up these appended namespaces and get the real namespaces?
Thanks again.
|
|

June 23rd, 2008, 02:32 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
There are quite a few ways to search, what does the node look like and what are the rules for searching? What XSLT processor are you using?
You talk about namespaces being changes whereas it seems only the prefixes are changed, this shouldn't matter, why do you care what prefixes are used?
You need, as others have mentioned, to give a more detailed breakdown of your process.
--
Joe ( Microsoft MVP - XML)
|
|

June 23rd, 2008, 03:32 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
>I tried to extract a value (eg: employeeID) from a text node which has lot other information (like employee name, dept, designation, etc.). Is there a way to search for a particular string in a text node?
In XSLT 2.0 you can use regular expressions and xsl:analyze-string. In 1.0 you're confined to simple functions like substring-before() and substring-after(). But check the EXSLT library at www.exslt.org
>I faced something strange the other day. I was able to save the XML response on the client's local drive but when I opened it, I found some of the namespaces were replaced by ns1, ns2, etc.
I assume you mean the namespace prefixes. I suspect this isn't an XSLT question.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|

June 23rd, 2008, 09:12 PM
|
|
Authorized User
|
|
Join Date: Jun 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Oops! sorry about that.
And, thanks for the prompt replies.
XSLT processor: Xalan
Rules for searching: not specific
What does the node look like?: (Just pasting some text from today's sports column)
Eg: The Celtics downed the Lakers in six games, keeping Bryant from claiming his first title since L.A. traded O'Neal to the Miami Heat following: 2003-04 season. O'Neal, meanwhile, has won a championship without Bryant, helping the Heat to the 2006 NBA title.
And, suppose I want to extract 2003-04.
For this I used a variable and few functions like substring-before, normalize-string to extract the required string from the text node. (I think I can take care of this now.)
>I assume you mean the namespace prefixes. I suspect this isn't an XSLT question.
Yes, they are namespace prefixes. After saving that XML response on the local drive it might be used as an input to some other process. So, I'm not sure if I have to care about those prefixes.
[u]New problem:</u>
Every time I take a step ahead, I need to look back my previous step and correct it.
[u]Description:</u>
I have a web app which has an XSL stylesheet with a parameter "EIN"
with a value "emp". This stylesheet includes another stylesheet in it. And, in the included stylesheet when the parameter's value is checked against "emp", it's not the value that its having. The parameter in the included stylesheet has nothing in it.
Parameter Declaration in the parent stylesheet:
<xsl:param name="EIN" select="emp"/>
Parameter In The Included Stylesheet:
I used xsl: when to check the value and if it has the right value then calls a templete, if not then a different template. (Just giving you a picture as I don't remember the exact code - Sorry if it's not misleading)
This is working fine in other environments but not on my local machine. I just wanted to know what might have caused the parameter to have nothing in it. Do I have to consider something which I'm unaware of?
I'll try to work on it thou.
But, please let me know if I'm ignoring something.
Thanks again.
|
|

June 24th, 2008, 01:59 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
Quote:
quote:Originally posted by kaukabhishek
Oops! sorry about that.
And, thanks for the prompt replies.
XSLT processor: Xalan
Rules for searching: not specific
What does the node look like?: (Just pasting some text from today's sports column)
Eg: The Celtics downed the Lakers in six games, keeping Bryant from claiming his first title since L.A. traded O'Neal to the Miami Heat following: 2003-04 season. O'Neal, meanwhile, has won a championship without Bryant, helping the Heat to the 2006 NBA title.
And, suppose I want to extract 2003-04.
For this I used a variable and few functions like substring-before, normalize-string to extract the required string from the text node. (I think I can take care of this now.)
|
Okay, but how do you know what you are looking for? Can I search on any text string?
Quote:
quote:
>I assume you mean the namespace prefixes. I suspect this isn't an XSLT question.
Yes, they are namespace prefixes. After saving that XML response on the local drive it might be used as an input to some other process. So, I'm not sure if I have to care about those prefixes.
|
Correct, if it's a proper XML parser the prefixes are irrelevant.
Quote:
quote:
[u]New problem:</u>
Every time I take a step ahead, I need to look back my previous step and correct it.
[u]Description:</u>
I have a web app which has an XSL stylesheet with a parameter "EIN"
with a value "emp". This stylesheet includes another stylesheet in it. And, in the included stylesheet when the parameter's value is checked against "emp", it's not the value that its having. The parameter in the included stylesheet has nothing in it.
Parameter Declaration in the parent stylesheet:
<xsl:param name="EIN" select="emp"/>
Parameter In The Included Stylesheet:
I used xsl: when to check the value and if it has the right value then calls a templete, if not then a different template. (Just giving you a picture as I don't remember the exact code - Sorry if it's not misleading)
This is working fine in other environments but not on my local machine. I just wanted to know what might have caused the parameter to have nothing in it. Do I have to consider something which I'm unaware of?
I'll try to work on it thou.
But, please let me know if I'm ignoring something.
Thanks again.
|
Can you show a bare example of how the stylesheet is included and where you test the param?
--
Joe ( Microsoft MVP - XML)
|
|

June 25th, 2008, 07:16 PM
|
|
Authorized User
|
|
Join Date: Jun 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I figured it out.
I traced out what went wrong. It was a configuration issue.
Everything is on the right track now.
You all have been a great help.
Thank you.
|
|
 |