Audball
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Audball
-
-
Thanks for the responce, boen_robot. No, the <xml:text> wasn't necessary at all -- it was a byproduct of having started learning XSLT yesterday Ultimately, I ended up NOT using a variable, and instead using the XSLT 2.0 <xsl:namespace> feature, thusly:
<xsl:template match="Foo"> <xsl:element name="xs:element"> <xsl:attribute name="ref"> <xsl:value-of select="concat(Bar, ':', Bar)"/> </xsl:attribute> <xsl:namespace name="{Bar}"> <xsl:value-of select="concat('A:B:C:', Bar)"/> </xsl:namespace> </xsl:element> </xsl:template>
I'll put your example as a comment in the transform, just in case I need to revert back to XSLT 1.0 features :)Cheers,David
-
I have some XML input like this:
<Foo> <Bar>Baz</Bar></Foo>
What I'd like to generate is (don't worry about the xs:import for A:B:C:Baz):
<xs:element ref="Baz:Baz" xmlns:Baz="A:B:C:Baz"/>
Here's what I have so far:
<xsl:template match="Foo"> <xsl:element name="xs:element"> <xsl:attribute name="ref"> <xsl:value-of select="Bar"/> <xsl:text>:</xsl:text> <xsl:value-of select="Bar"/> </xsl:attribute> <xsl:variable name="bazNamespace"> <xsl:text>xmlns:</xsl:text> <xsl:value-of select="Bar"/> </xsl:variable> <xsl:attribute name="HowDoIDoThis-{$bazNamespace}-DoesNotWork"> <xsl:text>A:B:C:</xsl:text> <xsl:value-of select="Bar"/> </xsl:attribute> </xsl:element></xsl:template>
I guess I could manually build the element and attributes with a buch of <xsl:text>, but that seems crummy.Any ideas?
xsl:attribute w/variable for 'name' attribute?
in XSLT/XSL-FO
Posted
I'm not worried about browsers, as the associated .XSD, .XSL, and .XML files are all intended for our own custom application. All they need to do is be edited/validated/tested in any decent XML editor (I'm using Oxygen 7.1 for now), and be loadable (only the .XMLs) via Xerces-C in C++ code. The generated schemas by the .XSL transforms are only ever going to be used for validation against .XML files created in the .XML editor -- it's completely a data-driven input/output approach, and I'm using XSLT literally for transforming, NOT for display purposes.