How can I read an element / tag below - using xsl + xpath, I have to format the XML output to read Trying to style alignment with style, but I can not understand it ... (Last Sahara C #)
Edit : To clarify my answer , I'm reading many html in documents, I'll have a list of the most acceptable tags that I need parsing Therefore, everything is not required for parsing, because I am using xslt, to transfer the document to XML in TM, I am keeping my solution in mind so far, though in view of XSL + xpath Keeping in mind if I want to use C # and Linux (to repeat on the document) - it's obvious that he will set up all the genres, With other additions. My XSL: Note, there is only one style defined below, but can be very ... (underlined etc.) desired output: With the famous tokening pattern, this stylesheet: Output:
& lt; H1 style = "text-line: true;" & gt; Another chapter & lt; / H1>
& lt; Xsl: template match = "h1" & gt; & Lt; Fo: block color = "black" font-family = "ariel, verdana, non-serif" & gt; & Lt; Xsl: call-template name = "set-alignment" /> & Lt; For /: Block & gt; & Lt; / XSL: Templates & gt; & Lt; Xsl: Template name = "set-alignment" & gt; & Lt; XSL: Select & gt; & Lt; Xsl: when test = "@ align = 'left'" & gt; & Lt; Xsl: attribute name = "text-align" & gt; Start & lt; / Xsl: attribute & gt; & Lt; / XSL: When & gt; & Lt; Xsl: when test = "@ align = 'center'" & gt; & Lt; Xsl: attribute name = "text-align" & gt; Center & lt; / Xsl: attribute & gt; & Lt; / XSL: When & gt; & Lt; Xsl: when test = "@ align = 'right'" & gt; & Lt; Xsl: attribute name = "text-align" & gt; End & lt; / Xsl: attribute & gt; & Lt; / XSL: When & gt; & Lt; / XSL: Select & gt; & Lt; / XSL: Templates & gt;
and lt; H1 text-align = "start" text-decoration = "underline" & gt; Another chapter & lt; / H1>
< Code> & lt; Xsl: stylesheet version = "1.0" xmlns: xsl = "http://www.w3.org/1999/XSL/Transform" & gt; & Lt; Xsl: template match = "node () | @ *" & gt; & Lt; XSL: Copy & gt; & Lt; Xsl: apply-select template = "node () | @ *" /> & Lt; / XSL: Copy & gt; & Lt; / XSL: Templates & gt; & Lt; Xsl: template match = "h1" & gt; & Lt; XSL: Copy & gt; & Lt; Xsl: Apply-Select Template = "@ * [Name (!! = 'style']" />
& lt; H1 text-align = "right" & gt; Another chapter & lt; / H1>
Comments
Post a Comment