Specific part/character of the value in XML
Does anyone know how to select specific character or part in XML value in node?
For example I have value <Country> Holland </Country>
or <City>'s-Hertogenbosch</City>
and I want to select 'a' character from <Country>
and '
(single quote) in <City>
without using substring() functions: how can I achieve that? I tried almost everything, but except substring, substring-before, substring-after neither is working.
xml xslt xpath tibco tibco-business-works
add a comment |
Does anyone know how to select specific character or part in XML value in node?
For example I have value <Country> Holland </Country>
or <City>'s-Hertogenbosch</City>
and I want to select 'a' character from <Country>
and '
(single quote) in <City>
without using substring() functions: how can I achieve that? I tried almost everything, but except substring, substring-before, substring-after neither is working.
xml xslt xpath tibco tibco-business-works
You can also use analyze-string and replace function
– Navin Rawat
Nov 12 '18 at 12:34
Your question is not clear. How do you know which character you want to select? Select for what purpose? -- Also, what is the idea of without using substring() functions? These functions are integral to XPath/XSLT. If you can't use them, retag your question.
– michael.hor257k
Nov 12 '18 at 13:07
Actually my question is clear..for example i have muliple inbound messages like particular XML format when most of the values in specific nodes have single quotes and i can't inject them in the DB..i can escape those single quotes with backslash '' but i can do it only manualy with substring functions in every single node..what if i have dozens values with single quotes?..how can i resolve them?
– Mihail Mitrevski
Nov 12 '18 at 13:38
1
No, actually your question is a classic XY problem. If you want to escape single quotes, you need to replace them with the escaped string. In XSLT 1.0*, this is done using a named recursive template - see, for example: stackoverflow.com/questions/30339128/… -- (*) I am assuming from your other question that you cannot use XSLT 2.0.
– michael.hor257k
Nov 12 '18 at 13:45
add a comment |
Does anyone know how to select specific character or part in XML value in node?
For example I have value <Country> Holland </Country>
or <City>'s-Hertogenbosch</City>
and I want to select 'a' character from <Country>
and '
(single quote) in <City>
without using substring() functions: how can I achieve that? I tried almost everything, but except substring, substring-before, substring-after neither is working.
xml xslt xpath tibco tibco-business-works
Does anyone know how to select specific character or part in XML value in node?
For example I have value <Country> Holland </Country>
or <City>'s-Hertogenbosch</City>
and I want to select 'a' character from <Country>
and '
(single quote) in <City>
without using substring() functions: how can I achieve that? I tried almost everything, but except substring, substring-before, substring-after neither is working.
xml xslt xpath tibco tibco-business-works
xml xslt xpath tibco tibco-business-works
edited Nov 12 '18 at 14:33
Armali
7,2451137101
7,2451137101
asked Nov 12 '18 at 11:52
Mihail MitrevskiMihail Mitrevski
255
255
You can also use analyze-string and replace function
– Navin Rawat
Nov 12 '18 at 12:34
Your question is not clear. How do you know which character you want to select? Select for what purpose? -- Also, what is the idea of without using substring() functions? These functions are integral to XPath/XSLT. If you can't use them, retag your question.
– michael.hor257k
Nov 12 '18 at 13:07
Actually my question is clear..for example i have muliple inbound messages like particular XML format when most of the values in specific nodes have single quotes and i can't inject them in the DB..i can escape those single quotes with backslash '' but i can do it only manualy with substring functions in every single node..what if i have dozens values with single quotes?..how can i resolve them?
– Mihail Mitrevski
Nov 12 '18 at 13:38
1
No, actually your question is a classic XY problem. If you want to escape single quotes, you need to replace them with the escaped string. In XSLT 1.0*, this is done using a named recursive template - see, for example: stackoverflow.com/questions/30339128/… -- (*) I am assuming from your other question that you cannot use XSLT 2.0.
– michael.hor257k
Nov 12 '18 at 13:45
add a comment |
You can also use analyze-string and replace function
– Navin Rawat
Nov 12 '18 at 12:34
Your question is not clear. How do you know which character you want to select? Select for what purpose? -- Also, what is the idea of without using substring() functions? These functions are integral to XPath/XSLT. If you can't use them, retag your question.
– michael.hor257k
Nov 12 '18 at 13:07
Actually my question is clear..for example i have muliple inbound messages like particular XML format when most of the values in specific nodes have single quotes and i can't inject them in the DB..i can escape those single quotes with backslash '' but i can do it only manualy with substring functions in every single node..what if i have dozens values with single quotes?..how can i resolve them?
– Mihail Mitrevski
Nov 12 '18 at 13:38
1
No, actually your question is a classic XY problem. If you want to escape single quotes, you need to replace them with the escaped string. In XSLT 1.0*, this is done using a named recursive template - see, for example: stackoverflow.com/questions/30339128/… -- (*) I am assuming from your other question that you cannot use XSLT 2.0.
– michael.hor257k
Nov 12 '18 at 13:45
You can also use analyze-string and replace function
– Navin Rawat
Nov 12 '18 at 12:34
You can also use analyze-string and replace function
– Navin Rawat
Nov 12 '18 at 12:34
Your question is not clear. How do you know which character you want to select? Select for what purpose? -- Also, what is the idea of without using substring() functions? These functions are integral to XPath/XSLT. If you can't use them, retag your question.
– michael.hor257k
Nov 12 '18 at 13:07
Your question is not clear. How do you know which character you want to select? Select for what purpose? -- Also, what is the idea of without using substring() functions? These functions are integral to XPath/XSLT. If you can't use them, retag your question.
– michael.hor257k
Nov 12 '18 at 13:07
Actually my question is clear..for example i have muliple inbound messages like particular XML format when most of the values in specific nodes have single quotes and i can't inject them in the DB..i can escape those single quotes with backslash '' but i can do it only manualy with substring functions in every single node..what if i have dozens values with single quotes?..how can i resolve them?
– Mihail Mitrevski
Nov 12 '18 at 13:38
Actually my question is clear..for example i have muliple inbound messages like particular XML format when most of the values in specific nodes have single quotes and i can't inject them in the DB..i can escape those single quotes with backslash '' but i can do it only manualy with substring functions in every single node..what if i have dozens values with single quotes?..how can i resolve them?
– Mihail Mitrevski
Nov 12 '18 at 13:38
1
1
No, actually your question is a classic XY problem. If you want to escape single quotes, you need to replace them with the escaped string. In XSLT 1.0*, this is done using a named recursive template - see, for example: stackoverflow.com/questions/30339128/… -- (*) I am assuming from your other question that you cannot use XSLT 2.0.
– michael.hor257k
Nov 12 '18 at 13:45
No, actually your question is a classic XY problem. If you want to escape single quotes, you need to replace them with the escaped string. In XSLT 1.0*, this is done using a named recursive template - see, for example: stackoverflow.com/questions/30339128/… -- (*) I am assuming from your other question that you cannot use XSLT 2.0.
– michael.hor257k
Nov 12 '18 at 13:45
add a comment |
2 Answers
2
active
oldest
votes
I solve this two days ago , first i rendered whole data with render-xml() function and in the output whole node-set is provided as a string..then i split that string with function tokenize() in every single quote character or 'a'..for example tokenize($string, "&")
and the in the other variable i put them together like this string-join($tokenize, "&t;")
..it seems to work for me...previous i used concat-sequence-format(&tokenize,"&t;")
as instead of string i insert a node-set, but obviously is not working (as a node-set)and i don't know why.
add a comment |
Is not clear what you are trying to achieve. What you can do is to use the following flow:
convert the xml to a clean STRING (uglify it).
use a java activity with java Regular Expressions RegExp
put the selected words containing the character in a list structure
please give more details of what you are trying to achieve
stackoverflow.com/a/1732454
– michael.hor257k
Nov 23 '18 at 9:24
He wants to find characters in a string. The problem is that the information the user is providing in the question is abstracted and is not giving enough detail. I had to deal with some similar issue and the best thing was to sub-string or split.
– Andres Leon Rangel
Nov 25 '18 at 20:34
No, he wants to process XML.
– michael.hor257k
Nov 25 '18 at 20:51
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53261597%2fspecific-part-character-of-the-value-in-xml%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I solve this two days ago , first i rendered whole data with render-xml() function and in the output whole node-set is provided as a string..then i split that string with function tokenize() in every single quote character or 'a'..for example tokenize($string, "&")
and the in the other variable i put them together like this string-join($tokenize, "&t;")
..it seems to work for me...previous i used concat-sequence-format(&tokenize,"&t;")
as instead of string i insert a node-set, but obviously is not working (as a node-set)and i don't know why.
add a comment |
I solve this two days ago , first i rendered whole data with render-xml() function and in the output whole node-set is provided as a string..then i split that string with function tokenize() in every single quote character or 'a'..for example tokenize($string, "&")
and the in the other variable i put them together like this string-join($tokenize, "&t;")
..it seems to work for me...previous i used concat-sequence-format(&tokenize,"&t;")
as instead of string i insert a node-set, but obviously is not working (as a node-set)and i don't know why.
add a comment |
I solve this two days ago , first i rendered whole data with render-xml() function and in the output whole node-set is provided as a string..then i split that string with function tokenize() in every single quote character or 'a'..for example tokenize($string, "&")
and the in the other variable i put them together like this string-join($tokenize, "&t;")
..it seems to work for me...previous i used concat-sequence-format(&tokenize,"&t;")
as instead of string i insert a node-set, but obviously is not working (as a node-set)and i don't know why.
I solve this two days ago , first i rendered whole data with render-xml() function and in the output whole node-set is provided as a string..then i split that string with function tokenize() in every single quote character or 'a'..for example tokenize($string, "&")
and the in the other variable i put them together like this string-join($tokenize, "&t;")
..it seems to work for me...previous i used concat-sequence-format(&tokenize,"&t;")
as instead of string i insert a node-set, but obviously is not working (as a node-set)and i don't know why.
answered Nov 15 '18 at 0:33
Mihail MitrevskiMihail Mitrevski
255
255
add a comment |
add a comment |
Is not clear what you are trying to achieve. What you can do is to use the following flow:
convert the xml to a clean STRING (uglify it).
use a java activity with java Regular Expressions RegExp
put the selected words containing the character in a list structure
please give more details of what you are trying to achieve
stackoverflow.com/a/1732454
– michael.hor257k
Nov 23 '18 at 9:24
He wants to find characters in a string. The problem is that the information the user is providing in the question is abstracted and is not giving enough detail. I had to deal with some similar issue and the best thing was to sub-string or split.
– Andres Leon Rangel
Nov 25 '18 at 20:34
No, he wants to process XML.
– michael.hor257k
Nov 25 '18 at 20:51
add a comment |
Is not clear what you are trying to achieve. What you can do is to use the following flow:
convert the xml to a clean STRING (uglify it).
use a java activity with java Regular Expressions RegExp
put the selected words containing the character in a list structure
please give more details of what you are trying to achieve
stackoverflow.com/a/1732454
– michael.hor257k
Nov 23 '18 at 9:24
He wants to find characters in a string. The problem is that the information the user is providing in the question is abstracted and is not giving enough detail. I had to deal with some similar issue and the best thing was to sub-string or split.
– Andres Leon Rangel
Nov 25 '18 at 20:34
No, he wants to process XML.
– michael.hor257k
Nov 25 '18 at 20:51
add a comment |
Is not clear what you are trying to achieve. What you can do is to use the following flow:
convert the xml to a clean STRING (uglify it).
use a java activity with java Regular Expressions RegExp
put the selected words containing the character in a list structure
please give more details of what you are trying to achieve
Is not clear what you are trying to achieve. What you can do is to use the following flow:
convert the xml to a clean STRING (uglify it).
use a java activity with java Regular Expressions RegExp
put the selected words containing the character in a list structure
please give more details of what you are trying to achieve
answered Nov 23 '18 at 5:04
Andres Leon RangelAndres Leon Rangel
6719
6719
stackoverflow.com/a/1732454
– michael.hor257k
Nov 23 '18 at 9:24
He wants to find characters in a string. The problem is that the information the user is providing in the question is abstracted and is not giving enough detail. I had to deal with some similar issue and the best thing was to sub-string or split.
– Andres Leon Rangel
Nov 25 '18 at 20:34
No, he wants to process XML.
– michael.hor257k
Nov 25 '18 at 20:51
add a comment |
stackoverflow.com/a/1732454
– michael.hor257k
Nov 23 '18 at 9:24
He wants to find characters in a string. The problem is that the information the user is providing in the question is abstracted and is not giving enough detail. I had to deal with some similar issue and the best thing was to sub-string or split.
– Andres Leon Rangel
Nov 25 '18 at 20:34
No, he wants to process XML.
– michael.hor257k
Nov 25 '18 at 20:51
stackoverflow.com/a/1732454
– michael.hor257k
Nov 23 '18 at 9:24
stackoverflow.com/a/1732454
– michael.hor257k
Nov 23 '18 at 9:24
He wants to find characters in a string. The problem is that the information the user is providing in the question is abstracted and is not giving enough detail. I had to deal with some similar issue and the best thing was to sub-string or split.
– Andres Leon Rangel
Nov 25 '18 at 20:34
He wants to find characters in a string. The problem is that the information the user is providing in the question is abstracted and is not giving enough detail. I had to deal with some similar issue and the best thing was to sub-string or split.
– Andres Leon Rangel
Nov 25 '18 at 20:34
No, he wants to process XML.
– michael.hor257k
Nov 25 '18 at 20:51
No, he wants to process XML.
– michael.hor257k
Nov 25 '18 at 20:51
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53261597%2fspecific-part-character-of-the-value-in-xml%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You can also use analyze-string and replace function
– Navin Rawat
Nov 12 '18 at 12:34
Your question is not clear. How do you know which character you want to select? Select for what purpose? -- Also, what is the idea of without using substring() functions? These functions are integral to XPath/XSLT. If you can't use them, retag your question.
– michael.hor257k
Nov 12 '18 at 13:07
Actually my question is clear..for example i have muliple inbound messages like particular XML format when most of the values in specific nodes have single quotes and i can't inject them in the DB..i can escape those single quotes with backslash '' but i can do it only manualy with substring functions in every single node..what if i have dozens values with single quotes?..how can i resolve them?
– Mihail Mitrevski
Nov 12 '18 at 13:38
1
No, actually your question is a classic XY problem. If you want to escape single quotes, you need to replace them with the escaped string. In XSLT 1.0*, this is done using a named recursive template - see, for example: stackoverflow.com/questions/30339128/… -- (*) I am assuming from your other question that you cannot use XSLT 2.0.
– michael.hor257k
Nov 12 '18 at 13:45