-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alternate XML output? #16
Comments
That wouldn’t be hard for me to take care of. And putting XSLT into the
picture just for that seems to be a waste. Out of curiosity, is is
specifically the Id attribute, but the other XML attributes are OK? Is it
the name “Id” or just that the tags where it shows up need to not have any
attributes?
Scott
On December 19, 2019 at 1:37:17 PM, Jon Osborn ([email protected]) wrote:
More of a comment about a potential extension. We load the output into a
document database and use XPath to access the data. As the elements have an
@id attribute in them, the XPaths get a bit ugly. To that end, we run the
output through the following XSLT which moves the @id into the element name
(when a segment or element). It would be fantastic if element naming was an
option so we could stop using the XSLT.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="segment[@id]">
<xsl:element name="{normalize-space(@id)}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="element[@id]">
<xsl:element name="{normalize-space(@id)}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#16?email_source=notifications&email_token=ABQDKPEE4UWLFNPKB53WGULQZPEO3A5CNFSM4J5OHHMKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IBXVKSQ>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQDKPGURHKDP4L36Y6WSADQZPEO3ANCNFSM4J5OHHMA>
.
|
Just the "Id" attribute is needed because this establishes more direct XPath expressions. The other attributes really are data attributes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More of a comment about a potential extension. We load the output into a document database and use XPath to access the data. As the elements have an
@Id
attribute in them, the XPaths get a bit ugly. To that end, we run the output through the following XSLT which moves the@Id
into the element name (when a segment or element). It would be fantastic if element naming was an option so we could stop using the XSLT.The text was updated successfully, but these errors were encountered: