[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to remove a single quote?
On 31/07/2024 21:51, dvint@xxxxxxxxx wrote: > I have content like this: > > <topic file="fs_task_with_collapse_in_tabs.dita" > B B B B title="FORMAT: task inside a tab using collapsed sections" > B B B B chunk="child" > B B B B B B B tabtitle="'Collapse Sections'"> > > Notice the single quotes in the tabtitle attrbiute. I would like to > get just the text out of that attribute without the quotes. I've been > trying to use substring-before/after like this but I get no result > > <xsl:attribute name="tabtitle" select="substring-after(@tabtitle, > ''')"/> > > I'm getting an unmatched quote message and if I switch to ''' I get > the same message. I thought the entity would escape this. If I use > ", I don't get the error, but my result is empty as that > character doesn't exist. > > What is the proper way to escape and match a ' ? > > I suggested <xsl:attribute name="tabtitle" select="translate(@tabtitle, "'", "")"/> and that works for me <https://martin-honnen.github.io/cheerpj3-saxonhe12-fiddle/?code=%3C%3Fxml+ve rsion%3D%221.0%22+encoding%3D%22utf-8%22%3F%3E%0A%3Cxsl%3Astylesheet+xmlns%3A xsl%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2FXSL%2FTransform%22%0A++version%3D%2 23.0%22%0A++xmlns%3Axs%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%22%0A+ +exclude-result-prefixes%3D%22%23all%22%0A++expand-text%3D%22yes%22%3E%0A%0A+ +%3Cxsl%3Amode+on-no-match%3D%22shallow-copy%22%2F%3E%0A++%0A++%3Cxsl%3Atempl ate+match%3D%22%40tabtitle%22%3E%0A++++%3Cxsl%3Aattribute+name%3D%22tabtitle% 22+select%3D%22translate%28.%2C+%26quot%3B%27%26quot%3B%2C+%26quot%3B%26quot% 3B%29%22%2F%3E%0A++%3C%2Fxsl%3Atemplate%3E%0A%0A++%3Cxsl%3Atemplate+match%3D% 22%2F%22+name%3D%22xsl%3Ainitial-template%22%3E%0A++++%3Cxsl%3Acopy%3E%0A++++ ++%3Cxsl%3Aapply-templates%2F%3E%0A++++++%3Cxsl%3Acomment%3ERun+with+%7Bsyste m-property%28%27xsl%3Aproduct-name%27%29%7D+%7Bsystem-property%28%27xsl%3Apro duct-version%27%29%7D+at+%7Bcurrent-dateTime%28%29%7D%3C%2Fxsl%3Acomment%3E%0 A++++%3C%2Fxsl%3Acopy%3E%0A++%3C%2Fxsl%3Atemplate%3E%0A%0A%3C%2Fxsl%3Astylesh eet%3E%0A&input=%3Ctopic+file%3D%22fs_task_with_collapse_in_tabs.dita%22%0A++ ++title%3D%22FORMAT%3A+task+inside+a+tab+using+collapsed+sections%22%0A++++ch unk%3D%22child%22%0A++++++++tabtitle%3D%22%27Collapse+Sections%27%22%2F%3E+%0 A&code-type=XSLT&input-type=XML> (adapted for matching directly on the attribute node)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|