xslt

XSLT 1.0, Using Identity Transform, with multiple templates fails to match

[亡魂溺海] 提交于 2021-01-05 08:56:37
问题 Wow, I haven't asked this many questions since, intro to programming some 15 years ago, this XSLT stuff is kicking me! I've been learning to work with Identity Transform, to take a string and break it into nodes based on a delimiter. Which I have working as expected, but when I combine it with the rest of my logic it breaks. I'm thinking it has to do with my selectors on the elements themselves. I'm just proud of myself that I figured out a working basic example of Identity transform. I've

How to apply a function to a sequence of nodes in XSLT

怎甘沉沦 提交于 2021-01-04 04:31:00
问题 I need to write an XSLT function that transforms a sequence of nodes into a sequence of strings. What I need to do is to apply a function to all the nodes in the sequence and return a sequence as long as the original one. This is the input document <article id="4"> <author ref="#Guy1"/> <author ref="#Guy2"/> </article> This is how the calling site: <xsl:template match="article"> <xsl:text>Author for </xsl:text> <xsl:value-of select="@id"/> <xsl:variable name="names" select="func:author-names(

How to apply a function to a sequence of nodes in XSLT

巧了我就是萌 提交于 2021-01-04 04:27:33
问题 I need to write an XSLT function that transforms a sequence of nodes into a sequence of strings. What I need to do is to apply a function to all the nodes in the sequence and return a sequence as long as the original one. This is the input document <article id="4"> <author ref="#Guy1"/> <author ref="#Guy2"/> </article> This is how the calling site: <xsl:template match="article"> <xsl:text>Author for </xsl:text> <xsl:value-of select="@id"/> <xsl:variable name="names" select="func:author-names(

XSL-FO: displaying Arabic characters

萝らか妹 提交于 2021-01-03 05:52:15
问题 Please, I have a problem displaying the Arabic language in my reports generated in PDF format using the api fop 1.0 (XSL-FO). I configured a userConfig.xml for using Arial.ttf font. everything works fine except that characters are displayed separately. example: ت ق و ل instead of تقول I put spaces only to explain to you. <fo:block-container font-size="12pt" writing-mode="rl-tb" xml:lang="ar" font-family="Arial" xmlns:fo="http://www.w3.org/1999/XSL/Format" > <fo:block> تقول </fo:block> </fo

How can I transform some xml into a fixed length string using element attributes to define the value lengths [duplicate]

别来无恙 提交于 2020-12-15 05:51:15
问题 This question already has an answer here : XSLT 1.0 Kludge cleanup (1 answer) Closed 2 months ago . <?xml version="1.0" encoding="UTF-8"?> <Root> <Destination>acme.com</Destination> <Record> <FirstField length="10">AAAA</FirstField> <SecondField length="15">BBBB</SecondField> <SubRecord> <ThirdField length="20">CCCC</ThirdField> <FourthField length="8">DDDD</FourthField> </SubRecord> </Record> </Root> Hi, I have a requirement to take this xml example where the elements inside the node will be

Convert dateTime to UTC/GMT using pure XSLT 1.0

落花浮王杯 提交于 2020-12-15 03:52:33
问题 I couldn't find an existing answer to this problem, so I am posting it here. Note that input dateTimes: may or may not have fractional seconds; may already be in UTC/GMT, which complicates the process. Example input: <data> <datetime>2020-06-01T04:45:15+05:30</datetime> <datetime>2020-06-01T04:45:15.123+05:30</datetime> <datetime>2020-05-31T19:45:15-08:00</datetime> <datetime>2020-05-31T19:45:15.123-08:00</datetime> <datetime>2020-05-31T19:45:15Z</datetime> <datetime>2020-05-31T19:45:15.123Z<

Convert dateTime to UTC/GMT using pure XSLT 1.0

梦想的初衷 提交于 2020-12-15 03:52:12
问题 I couldn't find an existing answer to this problem, so I am posting it here. Note that input dateTimes: may or may not have fractional seconds; may already be in UTC/GMT, which complicates the process. Example input: <data> <datetime>2020-06-01T04:45:15+05:30</datetime> <datetime>2020-06-01T04:45:15.123+05:30</datetime> <datetime>2020-05-31T19:45:15-08:00</datetime> <datetime>2020-05-31T19:45:15.123-08:00</datetime> <datetime>2020-05-31T19:45:15Z</datetime> <datetime>2020-05-31T19:45:15.123Z<

keep only white-listed elements and/or attributes

馋奶兔 提交于 2020-12-13 05:43:31
问题 I have an XML file with a plethora of nodes, each having a vast amount of attributes. For simplicity, let us assume the XML looking like this: <?xml version="1.0" encoding="UTF-8"?> <root> <header /> <group> <node1 attr1="x" attr2="y" attr3="z" /> <node2 attr4="x" attr5="y" attr6="z" /> <node3 attr7="x" attr8="y" attr9="z" /> <node1 attr1="x" attr2="y" attr3="z" /> </group> </root> I would like to reduce this XML into a smaller version by reducing the content of /root/group/ by eliminating

XML schema, why xs:group can't be child of xs:all?

有些话、适合烂在心里 提交于 2020-12-12 17:41:09
问题 According to this page (and my practice), xs:group element cannot be child of xs:all . So something like <xs:group name="g"> <xs:element name="first" type="xs:string"/> <xs:element name="last" type="xs:string"/> </xs:group> <xs:all> <xs:group ref="g" minOccurs="0" maxOccurs="1"/> <xs:element name="id" type="xs:string"/> </xs:all> is not valid because group cannot be inside xs:all . But I want to define a schema, in which two elements ( first and last in above example) both exist or neither of

XML schema, why xs:group can't be child of xs:all?

女生的网名这么多〃 提交于 2020-12-12 17:39:11
问题 According to this page (and my practice), xs:group element cannot be child of xs:all . So something like <xs:group name="g"> <xs:element name="first" type="xs:string"/> <xs:element name="last" type="xs:string"/> </xs:group> <xs:all> <xs:group ref="g" minOccurs="0" maxOccurs="1"/> <xs:element name="id" type="xs:string"/> </xs:all> is not valid because group cannot be inside xs:all . But I want to define a schema, in which two elements ( first and last in above example) both exist or neither of